diff --git a/.travis.yml b/.travis.yml index ed365f43..2c51ac2b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -33,7 +33,6 @@ env: - STATUP_DIR=$GOPATH/src/github.com/hunterlong/statup before_deploy: - - mv $GOPATH/src/github.com/hunterlong/statup/statuper $GOPATH/src/github.com/hunterlong/statup/build/statuper - git config --local user.name "hunterlong" - git config --local user.email "info@socialeck.com" - make tag diff --git a/Makefile b/Makefile index 104654ee..dcfd31c9 100644 --- a/Makefile +++ b/Makefile @@ -208,8 +208,8 @@ dev-deps: $(GOGET) github.com/GeertJohan/go.rice $(GOGET) github.com/GeertJohan/go.rice/rice $(GOINSTALL) github.com/GeertJohan/go.rice/rice - $(GOCMD) get github.com/davecheney/godoc2md - $(GOCMD) install github.com/davecheney/godoc2md + $(GOCMD) get github.com/frioux/godoc2md + $(GOCMD) install github.com/frioux/godoc2md $(GOCMD) get github.com/axw/gocov/gocov $(GOCMD) get gopkg.in/matm/v1/gocov-html $(GOCMD) install gopkg.in/matm/v1/gocov-html diff --git a/dev/COVERAGE.html b/dev/COVERAGE.html index 3b3fcff5..faa78bc5 100644 --- a/dev/COVERAGE.html +++ b/dev/COVERAGE.html @@ -128,7 +128,7 @@
Coverage Report
-
Generated on 06 Oct 18 03:00 -0700 with gocov-html
Report Overview
+
Generated on 06 Oct 18 03:05 -0700 with gocov-html
Report Overview
diff --git a/dev/README.md b/dev/README.md index 65e2435a..39f21202 100644 --- a/dev/README.md +++ b/dev/README.md @@ -152,7 +152,7 @@ More info on: https://github.com/ #### Package files -[checker.go](/src/github.com/hunterlong/statup/core/checker.go) [checkin.go](/src/github.com/hunterlong/statup/core/checkin.go) [configs.go](/src/github.com/hunterlong/statup/core/configs.go) [core.go](/src/github.com/hunterlong/statup/core/core.go) [database.go](/src/github.com/hunterlong/statup/core/database.go) [doc.go](/src/github.com/hunterlong/statup/core/doc.go) [export.go](/src/github.com/hunterlong/statup/core/export.go) [failures.go](/src/github.com/hunterlong/statup/core/failures.go) [hits.go](/src/github.com/hunterlong/statup/core/hits.go) [sample.go](/src/github.com/hunterlong/statup/core/sample.go) [services.go](/src/github.com/hunterlong/statup/core/services.go) [users.go](/src/github.com/hunterlong/statup/core/users.go) +[checker.go](https://github.com/hunterlong/statup/tree/master/core/checker.go) [checkin.go](https://github.com/hunterlong/statup/tree/master/core/checkin.go) [configs.go](https://github.com/hunterlong/statup/tree/master/core/configs.go) [core.go](https://github.com/hunterlong/statup/tree/master/core/core.go) [database.go](https://github.com/hunterlong/statup/tree/master/core/database.go) [doc.go](https://github.com/hunterlong/statup/tree/master/core/doc.go) [export.go](https://github.com/hunterlong/statup/tree/master/core/export.go) [failures.go](https://github.com/hunterlong/statup/tree/master/core/failures.go) [hits.go](https://github.com/hunterlong/statup/tree/master/core/hits.go) [sample.go](https://github.com/hunterlong/statup/tree/master/core/sample.go) [services.go](https://github.com/hunterlong/statup/tree/master/core/services.go) [users.go](https://github.com/hunterlong/statup/tree/master/core/users.go) @@ -172,7 +172,7 @@ var ( ``` -## func [CheckHash](/src/target/users.go?s=2896:2938#L105) +## func [CheckHash](https://github.com/hunterlong/statup/tree/master/core/users.go?s=2896:2938#L105) ``` go func CheckHash(password, hash string) bool ``` @@ -180,7 +180,7 @@ CheckHash returns true if the password matches with a hashed bcrypt password -## func [CloseDB](/src/target/database.go?s=2503:2517#L81) +## func [CloseDB](https://github.com/hunterlong/statup/tree/master/core/database.go?s=2503:2517#L81) ``` go func CloseDB() ``` @@ -188,7 +188,7 @@ CloseDB will close the database connection if available -## func [CountFailures](/src/target/failures.go?s=2819:2846#L99) +## func [CountFailures](https://github.com/hunterlong/statup/tree/master/core/failures.go?s=2819:2846#L99) ``` go func CountFailures() uint64 ``` @@ -196,7 +196,7 @@ CountFailures returns the total count of failures for all services -## func [DatabaseMaintence](/src/target/database.go?s=7073:7097#L247) +## func [DatabaseMaintence](https://github.com/hunterlong/statup/tree/master/core/database.go?s=7073:7097#L247) ``` go func DatabaseMaintence() ``` @@ -205,7 +205,7 @@ this function is currently set to delete records 7+ days old every 60 minutes -## func [Dbtimestamp](/src/target/services.go?s=5171:5223#L180) +## func [Dbtimestamp](https://github.com/hunterlong/statup/tree/master/core/services.go?s=5171:5223#L180) ``` go func Dbtimestamp(group string, column string) string ``` @@ -213,7 +213,7 @@ Dbtimestamp will return a SQL query for grouping by date -## func [DeleteAllSince](/src/target/database.go?s=7406:7455#L257) +## func [DeleteAllSince](https://github.com/hunterlong/statup/tree/master/core/database.go?s=7406:7455#L257) ``` go func DeleteAllSince(table string, date time.Time) ``` @@ -221,7 +221,7 @@ DeleteAllSince will delete a specific table's records based on a time. -## func [DeleteConfig](/src/target/configs.go?s=3785:3804#L133) +## func [DeleteConfig](https://github.com/hunterlong/statup/tree/master/core/configs.go?s=3785:3804#L133) ``` go func DeleteConfig() ``` @@ -229,19 +229,19 @@ DeleteConfig will delete the 'config.yml' file -## func [ExportChartsJs](/src/target/export.go?s=2118:2146#L86) +## func [ExportChartsJs](https://github.com/hunterlong/statup/tree/master/core/export.go?s=2118:2146#L86) ``` go func ExportChartsJs() string ``` -## func [ExportIndexHTML](/src/target/export.go?s=889:918#L31) +## func [ExportIndexHTML](https://github.com/hunterlong/statup/tree/master/core/export.go?s=889:918#L31) ``` go func ExportIndexHTML() string ``` -## func [InitApp](/src/target/core.go?s=1690:1704#L60) +## func [InitApp](https://github.com/hunterlong/statup/tree/master/core/core.go?s=1690:1704#L60) ``` go func InitApp() ``` @@ -249,7 +249,7 @@ InitApp will initialize Statup -## func [InsertLargeSampleData](/src/target/sample.go?s=4671:4705#L179) +## func [InsertLargeSampleData](https://github.com/hunterlong/statup/tree/master/core/sample.go?s=4671:4705#L179) ``` go func InsertLargeSampleData() error ``` @@ -257,7 +257,7 @@ InsertSampleData will create the example/dummy services for a brand new Statup i -## func [InsertSampleData](/src/target/sample.go?s=897:926#L27) +## func [InsertSampleData](https://github.com/hunterlong/statup/tree/master/core/sample.go?s=897:926#L27) ``` go func InsertSampleData() error ``` @@ -265,7 +265,7 @@ InsertSampleData will create the example/dummy services for a brand new Statup i -## func [InsertSampleHits](/src/target/sample.go?s=3132:3161#L118) +## func [InsertSampleHits](https://github.com/hunterlong/statup/tree/master/core/sample.go?s=3132:3161#L118) ``` go func InsertSampleHits() error ``` @@ -273,14 +273,14 @@ InsertSampleHits will create a couple new hits for the sample services -## func [SaveFile](/src/target/export.go?s=2540:2589#L106) +## func [SaveFile](https://github.com/hunterlong/statup/tree/master/core/export.go?s=2540:2589#L106) ``` go func SaveFile(filename string, data []byte) error ``` -## type [Checkin](/src/target/checkin.go?s=818:857#L26) +## type [Checkin](https://github.com/hunterlong/statup/tree/master/core/checkin.go?s=818:857#L26) ``` go type Checkin struct { *types.Checkin @@ -293,14 +293,14 @@ type Checkin struct { -### func [ReturnCheckin](/src/target/checkin.go?s=1064:1109#L40) +### func [ReturnCheckin](https://github.com/hunterlong/statup/tree/master/core/checkin.go?s=1064:1109#L40) ``` go func ReturnCheckin(s *types.Checkin) *Checkin ``` ReturnCheckin converts *types.Checking to *core.Checkin -### func [SelectCheckin](/src/target/checkin.go?s=1369:1408#L50) +### func [SelectCheckin](https://github.com/hunterlong/statup/tree/master/core/checkin.go?s=1369:1408#L50) ``` go func SelectCheckin(api string) *Checkin ``` @@ -310,7 +310,7 @@ SelectCheckin will find a Checkin based on the API supplied -### func (\*Checkin) [AfterFind](/src/target/database.go?s=3376:3417#L117) +### func (\*Checkin) [AfterFind](https://github.com/hunterlong/statup/tree/master/core/database.go?s=3376:3417#L117) ``` go func (s *Checkin) AfterFind() (err error) ``` @@ -319,7 +319,7 @@ AfterFind for Checkin will set the timezone -### func (\*Checkin) [BeforeCreate](/src/target/database.go?s=4403:4447#L161) +### func (\*Checkin) [BeforeCreate](https://github.com/hunterlong/statup/tree/master/core/database.go?s=4403:4447#L161) ``` go func (u *Checkin) BeforeCreate() (err error) ``` @@ -328,7 +328,7 @@ BeforeCreate for Checkin will set CreatedAt to UTC -### func (\*Checkin) [Create](/src/target/checkin.go?s=2642:2683#L92) +### func (\*Checkin) [Create](https://github.com/hunterlong/statup/tree/master/core/checkin.go?s=2642:2683#L92) ``` go func (u *Checkin) Create() (int64, error) ``` @@ -337,7 +337,7 @@ Create will create a new Checkin -### func (\*Checkin) [Expected](/src/target/checkin.go?s=2028:2070#L69) +### func (\*Checkin) [Expected](https://github.com/hunterlong/statup/tree/master/core/checkin.go?s=2028:2070#L69) ``` go func (u *Checkin) Expected() time.Duration ``` @@ -346,7 +346,7 @@ Expected returns the duration of when the serviec should receive a checkin -### func (\*Checkin) [Grace](/src/target/checkin.go?s=1818:1857#L63) +### func (\*Checkin) [Grace](https://github.com/hunterlong/statup/tree/master/core/checkin.go?s=1818:1857#L63) ``` go func (u *Checkin) Grace() time.Duration ``` @@ -355,7 +355,7 @@ Grace will return the duration of the Checkin Grace Period (after service hasn't -### func (\*Checkin) [Hits](/src/target/checkin.go?s=2442:2479#L85) +### func (\*Checkin) [Hits](https://github.com/hunterlong/statup/tree/master/core/checkin.go?s=2442:2479#L85) ``` go func (u *Checkin) Hits() []CheckinHit ``` @@ -364,7 +364,7 @@ Hits returns all of the CheckinHits for a given Checkin -### func (\*Checkin) [Last](/src/target/checkin.go?s=2255:2290#L78) +### func (\*Checkin) [Last](https://github.com/hunterlong/statup/tree/master/core/checkin.go?s=2255:2290#L78) ``` go func (u *Checkin) Last() CheckinHit ``` @@ -373,7 +373,7 @@ Last returns the last CheckinHit for a Checkin -### func (\*Checkin) [Period](/src/target/checkin.go?s=1566:1606#L57) +### func (\*Checkin) [Period](https://github.com/hunterlong/statup/tree/master/core/checkin.go?s=1566:1606#L57) ``` go func (u *Checkin) Period() time.Duration ``` @@ -382,7 +382,7 @@ Period will return the duration of the Checkin interval -### func (\*Checkin) [RecheckCheckinFailure](/src/target/checkin.go?s=3622:3682#L132) +### func (\*Checkin) [RecheckCheckinFailure](https://github.com/hunterlong/statup/tree/master/core/checkin.go?s=3622:3682#L132) ``` go func (c *Checkin) RecheckCheckinFailure(guard chan struct{}) ``` @@ -391,7 +391,7 @@ RecheckCheckinFailure will check if a Service Checkin has been reported yet -### func (\*Checkin) [String](/src/target/checkin.go?s=949:982#L35) +### func (\*Checkin) [String](https://github.com/hunterlong/statup/tree/master/core/checkin.go?s=949:982#L35) ``` go func (c *Checkin) String() string ``` @@ -400,7 +400,7 @@ String will return a Checkin API string -### func (\*Checkin) [Update](/src/target/checkin.go?s=2884:2925#L103) +### func (\*Checkin) [Update](https://github.com/hunterlong/statup/tree/master/core/checkin.go?s=2884:2925#L103) ``` go func (u *Checkin) Update() (int64, error) ``` @@ -409,7 +409,7 @@ Update will update a Checkin -## type [CheckinHit](/src/target/checkin.go?s=859:904#L30) +## type [CheckinHit](https://github.com/hunterlong/statup/tree/master/core/checkin.go?s=859:904#L30) ``` go type CheckinHit struct { *types.CheckinHit @@ -422,7 +422,7 @@ type CheckinHit struct { -### func [ReturnCheckinHit](/src/target/checkin.go?s=1211:1265#L45) +### func [ReturnCheckinHit](https://github.com/hunterlong/statup/tree/master/core/checkin.go?s=1211:1265#L45) ``` go func ReturnCheckinHit(h *types.CheckinHit) *CheckinHit ``` @@ -432,7 +432,7 @@ ReturnCheckinHit converts *types.CheckinHit to *core.CheckinHit -### func (\*CheckinHit) [AfterFind](/src/target/database.go?s=3543:3587#L123) +### func (\*CheckinHit) [AfterFind](https://github.com/hunterlong/statup/tree/master/core/database.go?s=3543:3587#L123) ``` go func (s *CheckinHit) AfterFind() (err error) ``` @@ -441,7 +441,7 @@ AfterFind for CheckinHit will set the timezone -### func (\*CheckinHit) [Ago](/src/target/checkin.go?s=3432:3465#L126) +### func (\*CheckinHit) [Ago](https://github.com/hunterlong/statup/tree/master/core/checkin.go?s=3432:3465#L126) ``` go func (f *CheckinHit) Ago() string ``` @@ -450,7 +450,7 @@ Ago returns the duration of time between now and the last successful CheckinHit -### func (\*CheckinHit) [BeforeCreate](/src/target/database.go?s=4581:4628#L169) +### func (\*CheckinHit) [BeforeCreate](https://github.com/hunterlong/statup/tree/master/core/database.go?s=4581:4628#L169) ``` go func (u *CheckinHit) BeforeCreate() (err error) ``` @@ -459,7 +459,7 @@ BeforeCreate for CheckinHit will set CreatedAt to UTC -### func (\*CheckinHit) [Create](/src/target/checkin.go?s=3110:3154#L113) +### func (\*CheckinHit) [Create](https://github.com/hunterlong/statup/tree/master/core/checkin.go?s=3110:3154#L113) ``` go func (u *CheckinHit) Create() (int64, error) ``` @@ -468,7 +468,7 @@ Create will create a new successful CheckinHit -## type [Core](/src/target/core.go?s=967:1000#L31) +## type [Core](https://github.com/hunterlong/statup/tree/master/core/core.go?s=967:1000#L31) ``` go type Core struct { *types.Core @@ -481,21 +481,21 @@ type Core struct { -### func [NewCore](/src/target/core.go?s=1426:1446#L47) +### func [NewCore](https://github.com/hunterlong/statup/tree/master/core/core.go?s=1426:1446#L47) ``` go func NewCore() *Core ``` NewCore return a new *core.Core struct -### func [SelectCore](/src/target/core.go?s=3778:3810#L136) +### func [SelectCore](https://github.com/hunterlong/statup/tree/master/core/core.go?s=3778:3810#L136) ``` go func SelectCore() (*Core, error) ``` SelectCore will return the CoreApp global variable and the settings/configs for Statup -### func [UpdateCore](/src/target/core.go?s=2257:2296#L82) +### func [UpdateCore](https://github.com/hunterlong/statup/tree/master/core/core.go?s=2257:2296#L82) ``` go func UpdateCore(c *Core) (*Core, error) ``` @@ -505,7 +505,7 @@ UpdateCore will update the CoreApp variable inside of the 'core' table in databa -### func (Core) [AllOnline](/src/target/core.go?s=3552:3582#L126) +### func (Core) [AllOnline](https://github.com/hunterlong/statup/tree/master/core/core.go?s=3552:3582#L126) ``` go func (c Core) AllOnline() bool ``` @@ -514,7 +514,7 @@ AllOnline will be true if all services are online -### func (Core) [BaseSASS](/src/target/core.go?s=3055:3086#L109) +### func (Core) [BaseSASS](https://github.com/hunterlong/statup/tree/master/core/core.go?s=3055:3086#L109) ``` go func (c Core) BaseSASS() string ``` @@ -523,7 +523,7 @@ BaseSASS is the base design , this opens the file /assets/scss/base.scss to be e -### func (\*Core) [Count24HFailures](/src/target/failures.go?s=2547:2587#L88) +### func (\*Core) [Count24HFailures](https://github.com/hunterlong/statup/tree/master/core/failures.go?s=2547:2587#L88) ``` go func (c *Core) Count24HFailures() uint64 ``` @@ -532,7 +532,7 @@ Count24HFailures returns the amount of failures for a service within the last 24 -### func (\*Core) [CountOnline](/src/target/services.go?s=10815:10847#L382) +### func (\*Core) [CountOnline](https://github.com/hunterlong/statup/tree/master/core/services.go?s=10815:10847#L382) ``` go func (c *Core) CountOnline() int ``` @@ -541,7 +541,7 @@ CountOnline -### func (Core) [CurrentTime](/src/target/core.go?s=2410:2444#L88) +### func (Core) [CurrentTime](https://github.com/hunterlong/statup/tree/master/core/core.go?s=2410:2444#L88) ``` go func (c Core) CurrentTime() string ``` @@ -550,7 +550,7 @@ UsingAssets will return true if /assets folder is present -### func (Core) [MobileSASS](/src/target/core.go?s=3340:3373#L118) +### func (Core) [MobileSASS](https://github.com/hunterlong/statup/tree/master/core/core.go?s=3340:3373#L118) ``` go func (c Core) MobileSASS() string ``` @@ -560,7 +560,7 @@ file /assets/scss/mobile.scss to be edited in Theme -### func (Core) [SassVars](/src/target/core.go?s=2797:2828#L101) +### func (Core) [SassVars](https://github.com/hunterlong/statup/tree/master/core/core.go?s=2797:2828#L101) ``` go func (c Core) SassVars() string ``` @@ -569,7 +569,7 @@ SassVars opens the file /assets/scss/variables.scss to be edited in Theme -### func (\*Core) [SelectAllServices](/src/target/services.go?s=1729:1783#L62) +### func (\*Core) [SelectAllServices](https://github.com/hunterlong/statup/tree/master/core/services.go?s=1729:1783#L62) ``` go func (c *Core) SelectAllServices() ([]*Service, error) ``` @@ -578,7 +578,7 @@ SelectAllServices returns a slice of *core.Service to be store on []*core.Servic -### func (\*Core) [ServicesCount](/src/target/services.go?s=10736:10770#L377) +### func (\*Core) [ServicesCount](https://github.com/hunterlong/statup/tree/master/core/services.go?s=10736:10770#L377) ``` go func (c *Core) ServicesCount() int ``` @@ -587,7 +587,7 @@ ServicesCount returns the amount of services inside the []*core.Services slice -### func (\*Core) [ToCore](/src/target/core.go?s=1600:1635#L55) +### func (\*Core) [ToCore](https://github.com/hunterlong/statup/tree/master/core/core.go?s=1600:1635#L55) ``` go func (c *Core) ToCore() *types.Core ``` @@ -596,7 +596,7 @@ ToCore will convert *core.Core to *types.Core -### func (Core) [UsingAssets](/src/target/core.go?s=2638:2670#L96) +### func (Core) [UsingAssets](https://github.com/hunterlong/statup/tree/master/core/core.go?s=2638:2670#L96) ``` go func (c Core) UsingAssets() bool ``` @@ -605,7 +605,7 @@ UsingAssets will return true if /assets folder is present -## type [DateScan](/src/target/services.go?s=3675:3757#L133) +## type [DateScan](https://github.com/hunterlong/statup/tree/master/core/services.go?s=3675:3757#L133) ``` go type DateScan struct { CreatedAt string `json:"x"` @@ -624,7 +624,7 @@ DateScan struct is for creating the charts.js graph JSON array -## type [DateScanObj](/src/target/services.go?s=3828:3887#L139) +## type [DateScanObj](https://github.com/hunterlong/statup/tree/master/core/services.go?s=3828:3887#L139) ``` go type DateScanObj struct { Array []DateScan `json:"data"` @@ -639,7 +639,7 @@ DateScanObj struct is for creating the charts.js graph JSON array -### func [GraphDataRaw](/src/target/services.go?s=6296:6409#L216) +### func [GraphDataRaw](https://github.com/hunterlong/statup/tree/master/core/services.go?s=6296:6409#L216) ``` go func GraphDataRaw(service types.ServiceInterface, start, end time.Time, group string, column string) *DateScanObj ``` @@ -649,7 +649,7 @@ GraphDataRaw will return all the hits between 2 times for a Service -### func (\*DateScanObj) [ToString](/src/target/services.go?s=7072:7111#L238) +### func (\*DateScanObj) [ToString](https://github.com/hunterlong/statup/tree/master/core/services.go?s=7072:7111#L238) ``` go func (d *DateScanObj) ToString() string ``` @@ -658,7 +658,7 @@ ToString will convert the DateScanObj into a JSON string for the charts to rende -## type [DbConfig](/src/target/database.go?s=1099:1127#L37) +## type [DbConfig](https://github.com/hunterlong/statup/tree/master/core/database.go?s=1099:1127#L37) ``` go type DbConfig types.DbConfig ``` @@ -668,14 +668,14 @@ type DbConfig types.DbConfig -### func [LoadConfig](/src/target/configs.go?s=1020:1072#L34) +### func [LoadConfig](https://github.com/hunterlong/statup/tree/master/core/configs.go?s=1020:1072#L34) ``` go func LoadConfig(directory string) (*DbConfig, error) ``` LoadConfig will attempt to load the 'config.yml' file in a specific directory -### func [LoadUsingEnv](/src/target/configs.go?s=1680:1718#L53) +### func [LoadUsingEnv](https://github.com/hunterlong/statup/tree/master/core/configs.go?s=1680:1718#L53) ``` go func LoadUsingEnv() (*DbConfig, error) ``` @@ -685,7 +685,7 @@ LoadUsingEnv will attempt to load database configs based on environment variable -### func (\*DbConfig) [Close](/src/target/database.go?s=2617:2650#L88) +### func (\*DbConfig) [Close](https://github.com/hunterlong/statup/tree/master/core/database.go?s=2617:2650#L88) ``` go func (db *DbConfig) Close() error ``` @@ -694,7 +694,7 @@ Close shutsdown the database connection -### func (\*DbConfig) [Connect](/src/target/database.go?s=5265:5327#L193) +### func (\*DbConfig) [Connect](https://github.com/hunterlong/statup/tree/master/core/database.go?s=5265:5327#L193) ``` go func (db *DbConfig) Connect(retry bool, location string) error ``` @@ -703,7 +703,7 @@ Connect will attempt to connect to the sqlite, postgres, or mysql database -### func (\*DbConfig) [CreateCore](/src/target/database.go?s=8558:8595#L304) +### func (\*DbConfig) [CreateCore](https://github.com/hunterlong/statup/tree/master/core/database.go?s=8558:8595#L304) ``` go func (c *DbConfig) CreateCore() *Core ``` @@ -712,7 +712,7 @@ CreateCore will initialize the global variable 'CoreApp". This global variable c -### func (\*DbConfig) [CreateDatabase](/src/target/database.go?s=9609:9651#L340) +### func (\*DbConfig) [CreateDatabase](https://github.com/hunterlong/statup/tree/master/core/database.go?s=9609:9651#L340) ``` go func (db *DbConfig) CreateDatabase() error ``` @@ -721,7 +721,7 @@ CreateDatabase will CREATE TABLES for each of the Statup elements -### func (\*DbConfig) [DropDatabase](/src/target/database.go?s=9055:9095#L326) +### func (\*DbConfig) [DropDatabase](https://github.com/hunterlong/statup/tree/master/core/database.go?s=9055:9095#L326) ``` go func (db *DbConfig) DropDatabase() error ``` @@ -730,7 +730,7 @@ DropDatabase will DROP each table Statup created -### func (\*DbConfig) [InsertCore](/src/target/database.go?s=4773:4820#L177) +### func (\*DbConfig) [InsertCore](https://github.com/hunterlong/statup/tree/master/core/database.go?s=4773:4820#L177) ``` go func (db *DbConfig) InsertCore() (*Core, error) ``` @@ -739,7 +739,7 @@ InsertCore create the single row for the Core settings in Statup -### func (\*DbConfig) [MigrateDatabase](/src/target/database.go?s=10390:10433#L357) +### func (\*DbConfig) [MigrateDatabase](https://github.com/hunterlong/statup/tree/master/core/database.go?s=10390:10433#L357) ``` go func (db *DbConfig) MigrateDatabase() error ``` @@ -750,7 +750,7 @@ If this function has an issue, it will ROLLBACK to the previous state. -### func (\*DbConfig) [Save](/src/target/database.go?s=8035:8079#L284) +### func (\*DbConfig) [Save](https://github.com/hunterlong/statup/tree/master/core/database.go?s=8035:8079#L284) ``` go func (c *DbConfig) Save() (*DbConfig, error) ``` @@ -759,7 +759,7 @@ Save will initially create the config.yml file -### func (\*DbConfig) [Update](/src/target/database.go?s=7674:7707#L266) +### func (\*DbConfig) [Update](https://github.com/hunterlong/statup/tree/master/core/database.go?s=7674:7707#L266) ``` go func (c *DbConfig) Update() error ``` @@ -768,7 +768,7 @@ Update will save the config.yml file -## type [ErrorResponse](/src/target/configs.go?s=894:937#L29) +## type [ErrorResponse](https://github.com/hunterlong/statup/tree/master/core/configs.go?s=894:937#L29) ``` go type ErrorResponse struct { Error string @@ -786,7 +786,7 @@ ErrorResponse is used for HTTP errors to show to user -## type [Failure](/src/target/failures.go?s=829:868#L27) +## type [Failure](https://github.com/hunterlong/statup/tree/master/core/failures.go?s=829:868#L27) ``` go type Failure struct { *types.Failure @@ -802,7 +802,7 @@ type Failure struct { -### func (\*Failure) [AfterFind](/src/target/database.go?s=3054:3095#L105) +### func (\*Failure) [AfterFind](https://github.com/hunterlong/statup/tree/master/core/database.go?s=3054:3095#L105) ``` go func (f *Failure) AfterFind() (err error) ``` @@ -811,7 +811,7 @@ AfterFind for Failure will set the timezone -### func (\*Failure) [Ago](/src/target/failures.go?s=2207:2237#L76) +### func (\*Failure) [Ago](https://github.com/hunterlong/statup/tree/master/core/failures.go?s=2207:2237#L76) ``` go func (f *Failure) Ago() string ``` @@ -820,7 +820,7 @@ Ago returns a human readable timestamp for a failure -### func (\*Failure) [BeforeCreate](/src/target/database.go?s=3884:3928#L137) +### func (\*Failure) [BeforeCreate](https://github.com/hunterlong/statup/tree/master/core/database.go?s=3884:3928#L137) ``` go func (u *Failure) BeforeCreate() (err error) ``` @@ -829,7 +829,7 @@ BeforeCreate for Failure will set CreatedAt to UTC -### func (\*Failure) [Delete](/src/target/failures.go?s=2372:2404#L82) +### func (\*Failure) [Delete](https://github.com/hunterlong/statup/tree/master/core/failures.go?s=2372:2404#L82) ``` go func (f *Failure) Delete() error ``` @@ -838,7 +838,7 @@ Delete will remove a failure record from the database -### func (\*Failure) [ParseError](/src/target/failures.go?s=3855:3892#L132) +### func (\*Failure) [ParseError](https://github.com/hunterlong/statup/tree/master/core/failures.go?s=3855:3892#L132) ``` go func (f *Failure) ParseError() string ``` @@ -847,7 +847,7 @@ ParseError returns a human readable error for a failure -## type [Hit](/src/target/hits.go?s=782:813#L24) +## type [Hit](https://github.com/hunterlong/statup/tree/master/core/hits.go?s=782:813#L24) ``` go type Hit struct { *types.Hit @@ -863,7 +863,7 @@ type Hit struct { -### func (\*Hit) [AfterFind](/src/target/database.go?s=2894:2931#L99) +### func (\*Hit) [AfterFind](https://github.com/hunterlong/statup/tree/master/core/database.go?s=2894:2931#L99) ``` go func (s *Hit) AfterFind() (err error) ``` @@ -872,7 +872,7 @@ AfterFind for Hit will set the timezone -### func (\*Hit) [BeforeCreate](/src/target/database.go?s=3713:3753#L129) +### func (\*Hit) [BeforeCreate](https://github.com/hunterlong/statup/tree/master/core/database.go?s=3713:3753#L129) ``` go func (u *Hit) BeforeCreate() (err error) ``` @@ -881,7 +881,7 @@ BeforeCreate for Hit will set CreatedAt to UTC -## type [PluginJSON](/src/target/core.go?s=898:930#L28) +## type [PluginJSON](https://github.com/hunterlong/statup/tree/master/core/core.go?s=898:930#L28) ``` go type PluginJSON types.PluginJSON ``` @@ -894,7 +894,7 @@ type PluginJSON types.PluginJSON -## type [PluginRepos](/src/target/core.go?s=931:965#L29) +## type [PluginRepos](https://github.com/hunterlong/statup/tree/master/core/core.go?s=931:965#L29) ``` go type PluginRepos types.PluginRepos ``` @@ -907,7 +907,7 @@ type PluginRepos types.PluginRepos -## type [Service](/src/target/services.go?s=900:939#L30) +## type [Service](https://github.com/hunterlong/statup/tree/master/core/services.go?s=900:939#L30) ``` go type Service struct { *types.Service @@ -920,14 +920,14 @@ type Service struct { -### func [ReturnService](/src/target/services.go?s=1128:1173#L40) +### func [ReturnService](https://github.com/hunterlong/statup/tree/master/core/services.go?s=1128:1173#L40) ``` go func ReturnService(s *types.Service) *Service ``` ReturnService will convert *types.Service to *core.Service -### func [SelectService](/src/target/services.go?s=1255:1292#L45) +### func [SelectService](https://github.com/hunterlong/statup/tree/master/core/services.go?s=1255:1292#L45) ``` go func SelectService(id int64) *Service ``` @@ -937,7 +937,7 @@ SelectService returns a *core.Service from in memory -### func (\*Service) [AfterFind](/src/target/database.go?s=2734:2775#L93) +### func (\*Service) [AfterFind](https://github.com/hunterlong/statup/tree/master/core/database.go?s=2734:2775#L93) ``` go func (s *Service) AfterFind() (err error) ``` @@ -946,7 +946,7 @@ AfterFind for Service will set the timezone -### func (\*Service) [AllFailures](/src/target/failures.go?s=1249:1291#L44) +### func (\*Service) [AllFailures](https://github.com/hunterlong/statup/tree/master/core/failures.go?s=1249:1291#L44) ``` go func (s *Service) AllFailures() []*Failure ``` @@ -955,7 +955,7 @@ AllFailures will return all failures attached to a service -### func (\*Service) [AvgTime](/src/target/services.go?s=2596:2631#L92) +### func (\*Service) [AvgTime](https://github.com/hunterlong/statup/tree/master/core/services.go?s=2596:2631#L92) ``` go func (s *Service) AvgTime() float64 ``` @@ -964,7 +964,7 @@ AvgTime will return the average amount of time for a service to response back su -### func (\*Service) [AvgUptime](/src/target/services.go?s=7817:7866#L267) +### func (\*Service) [AvgUptime](https://github.com/hunterlong/statup/tree/master/core/services.go?s=7817:7866#L267) ``` go func (s *Service) AvgUptime(ago time.Time) string ``` @@ -973,7 +973,7 @@ AvgUptime returns average online status for last 24 hours -### func (\*Service) [AvgUptime24](/src/target/services.go?s=7647:7685#L261) +### func (\*Service) [AvgUptime24](https://github.com/hunterlong/statup/tree/master/core/services.go?s=7647:7685#L261) ``` go func (s *Service) AvgUptime24() string ``` @@ -982,7 +982,7 @@ AvgUptime24 returns a service's average online status for last 24 hours -### func (\*Service) [BeforeCreate](/src/target/database.go?s=4228:4272#L153) +### func (\*Service) [BeforeCreate](https://github.com/hunterlong/statup/tree/master/core/database.go?s=4228:4272#L153) ``` go func (u *Service) BeforeCreate() (err error) ``` @@ -991,7 +991,7 @@ BeforeCreate for Service will set CreatedAt to UTC -### func (\*Service) [Check](/src/target/checker.go?s=5538:5574#L222) +### func (\*Service) [Check](https://github.com/hunterlong/statup/tree/master/core/checker.go?s=5538:5574#L222) ``` go func (s *Service) Check(record bool) ``` @@ -1000,7 +1000,7 @@ Check will run checkHttp for HTTP services and checkTcp for TCP services -### func (\*Service) [CheckQueue](/src/target/checker.go?s=1256:1297#L43) +### func (\*Service) [CheckQueue](https://github.com/hunterlong/statup/tree/master/core/checker.go?s=1256:1297#L43) ``` go func (s *Service) CheckQueue(record bool) ``` @@ -1009,7 +1009,7 @@ CheckQueue is the main go routine for checking a service -### func (\*Service) [Checkins](/src/target/services.go?s=1463:1502#L55) +### func (\*Service) [Checkins](https://github.com/hunterlong/statup/tree/master/core/services.go?s=1463:1502#L55) ``` go func (s *Service) Checkins() []*Checkin ``` @@ -1018,7 +1018,7 @@ Checkins will return a slice of Checkins for a Service -### func (\*Service) [Create](/src/target/services.go?s=10250:10301#L361) +### func (\*Service) [Create](https://github.com/hunterlong/statup/tree/master/core/services.go?s=10250:10301#L361) ``` go func (u *Service) Create(check bool) (int64, error) ``` @@ -1027,7 +1027,7 @@ Create will create a service and insert it into the database -### func (\*Service) [CreateFailure](/src/target/failures.go?s=934:998#L32) +### func (\*Service) [CreateFailure](https://github.com/hunterlong/statup/tree/master/core/failures.go?s=934:998#L32) ``` go func (s *Service) CreateFailure(f *types.Failure) (int64, error) ``` @@ -1036,7 +1036,7 @@ CreateFailure will create a new failure record for a service -### func (\*Service) [CreateHit](/src/target/hits.go?s=907:963#L29) +### func (\*Service) [CreateHit](https://github.com/hunterlong/statup/tree/master/core/hits.go?s=907:963#L29) ``` go func (s *Service) CreateHit(h *types.Hit) (int64, error) ``` @@ -1045,7 +1045,7 @@ CreateHit will create a new 'hit' record in the database for a successful/online -### func (\*Service) [Delete](/src/target/services.go?s=9104:9136#L321) +### func (\*Service) [Delete](https://github.com/hunterlong/statup/tree/master/core/services.go?s=9104:9136#L321) ``` go func (u *Service) Delete() error ``` @@ -1054,7 +1054,7 @@ Delete will remove a service from the database, it will also end the service che -### func (\*Service) [DeleteFailures](/src/target/failures.go?s=1672:1706#L59) +### func (\*Service) [DeleteFailures](https://github.com/hunterlong/statup/tree/master/core/failures.go?s=1672:1706#L59) ``` go func (u *Service) DeleteFailures() ``` @@ -1063,7 +1063,7 @@ DeleteFailures will delete all failures for a service -### func (\*Service) [Downtime](/src/target/services.go?s=5906:5948#L202) +### func (\*Service) [Downtime](https://github.com/hunterlong/statup/tree/master/core/services.go?s=5906:5948#L202) ``` go func (s *Service) Downtime() time.Duration ``` @@ -1072,7 +1072,7 @@ Downtime returns the amount of time of a offline service -### func (\*Service) [DowntimeText](/src/target/services.go?s=4970:5009#L175) +### func (\*Service) [DowntimeText](https://github.com/hunterlong/statup/tree/master/core/services.go?s=4970:5009#L175) ``` go func (s *Service) DowntimeText() string ``` @@ -1081,7 +1081,7 @@ DowntimeText will return the amount of downtime for a service based on the durat -### func (\*Service) [GraphData](/src/target/services.go?s=7303:7339#L248) +### func (\*Service) [GraphData](https://github.com/hunterlong/statup/tree/master/core/services.go?s=7303:7339#L248) ``` go func (s *Service) GraphData() string ``` @@ -1090,7 +1090,7 @@ GraphData returns the JSON object used by Charts.js to render the chart -### func (\*Service) [Hits](/src/target/hits.go?s=1139:1185#L39) +### func (\*Service) [Hits](https://github.com/hunterlong/statup/tree/master/core/hits.go?s=1139:1185#L39) ``` go func (s *Service) Hits() ([]*types.Hit, error) ``` @@ -1099,7 +1099,7 @@ Hits returns all successful hits for a service -### func (\*Service) [HitsBetween](/src/target/database.go?s=2097:2182#L75) +### func (\*Service) [HitsBetween](https://github.com/hunterlong/statup/tree/master/core/database.go?s=2097:2182#L75) ``` go func (s *Service) HitsBetween(t1, t2 time.Time, group string, column string) *gorm.DB ``` @@ -1108,7 +1108,7 @@ HitsBetween returns the gorm database query for a collection of service hits bet -### func (\*Service) [LimitedFailures](/src/target/failures.go?s=1964:2010#L68) +### func (\*Service) [LimitedFailures](https://github.com/hunterlong/statup/tree/master/core/failures.go?s=1964:2010#L68) ``` go func (s *Service) LimitedFailures() []*Failure ``` @@ -1117,7 +1117,7 @@ LimitedFailures will return the last 10 failures from a service -### func (\*Service) [LimitedHits](/src/target/hits.go?s=1406:1459#L47) +### func (\*Service) [LimitedHits](https://github.com/hunterlong/statup/tree/master/core/hits.go?s=1406:1459#L47) ``` go func (s *Service) LimitedHits() ([]*types.Hit, error) ``` @@ -1126,7 +1126,7 @@ LimitedHits returns the last 1024 successful/online 'hit' records for a service -### func (\*Service) [Online24](/src/target/services.go?s=2922:2958#L105) +### func (\*Service) [Online24](https://github.com/hunterlong/statup/tree/master/core/services.go?s=2922:2958#L105) ``` go func (s *Service) Online24() float32 ``` @@ -1135,7 +1135,7 @@ Online24 returns the service's uptime percent within last 24 hours -### func (\*Service) [OnlineSince](/src/target/services.go?s=3122:3174#L111) +### func (\*Service) [OnlineSince](https://github.com/hunterlong/statup/tree/master/core/services.go?s=3122:3174#L111) ``` go func (s *Service) OnlineSince(ago time.Time) float32 ``` @@ -1144,7 +1144,7 @@ OnlineSince accepts a time since parameter to return the percent of a service's -### func (\*Service) [Select](/src/target/services.go?s=1001:1042#L35) +### func (\*Service) [Select](https://github.com/hunterlong/statup/tree/master/core/services.go?s=1001:1042#L35) ``` go func (s *Service) Select() *types.Service ``` @@ -1153,7 +1153,7 @@ Select will return the *types.Service struct for Service -### func (\*Service) [SmallText](/src/target/services.go?s=4172:4208#L154) +### func (\*Service) [SmallText](https://github.com/hunterlong/statup/tree/master/core/services.go?s=4172:4208#L154) ``` go func (s *Service) SmallText() string ``` @@ -1162,7 +1162,7 @@ SmallText returns a short description about a services status -### func (\*Service) [Sum](/src/target/hits.go?s=2458:2498#L79) +### func (\*Service) [Sum](https://github.com/hunterlong/statup/tree/master/core/hits.go?s=2458:2498#L79) ``` go func (s *Service) Sum() (float64, error) ``` @@ -1171,7 +1171,7 @@ Sum returns the added value Latency for all of the services successful hits. -### func (\*Service) [ToJSON](/src/target/services.go?s=2414:2447#L86) +### func (\*Service) [ToJSON](https://github.com/hunterlong/statup/tree/master/core/services.go?s=2414:2447#L86) ``` go func (s *Service) ToJSON() string ``` @@ -1180,7 +1180,7 @@ ToJSON will convert a service to a JSON string -### func (\*Service) [TotalFailures](/src/target/failures.go?s=3270:3319#L116) +### func (\*Service) [TotalFailures](https://github.com/hunterlong/statup/tree/master/core/failures.go?s=3270:3319#L116) ``` go func (s *Service) TotalFailures() (uint64, error) ``` @@ -1189,7 +1189,7 @@ TotalFailures returns the total amount of failures for a service -### func (\*Service) [TotalFailures24](/src/target/failures.go?s=3071:3122#L110) +### func (\*Service) [TotalFailures24](https://github.com/hunterlong/statup/tree/master/core/failures.go?s=3071:3122#L110) ``` go func (s *Service) TotalFailures24() (uint64, error) ``` @@ -1198,7 +1198,7 @@ TotalFailures24 returns the amount of failures for a service within the last 24 -### func (\*Service) [TotalFailuresSince](/src/target/failures.go?s=3544:3611#L124) +### func (\*Service) [TotalFailuresSince](https://github.com/hunterlong/statup/tree/master/core/failures.go?s=3544:3611#L124) ``` go func (s *Service) TotalFailuresSince(ago time.Time) (uint64, error) ``` @@ -1207,7 +1207,7 @@ TotalFailuresSince returns the total amount of failures for a service since a sp -### func (\*Service) [TotalHits](/src/target/hits.go?s=1889:1934#L63) +### func (\*Service) [TotalHits](https://github.com/hunterlong/statup/tree/master/core/hits.go?s=1889:1934#L63) ``` go func (s *Service) TotalHits() (uint64, error) ``` @@ -1216,7 +1216,7 @@ TotalHits returns the total amount of successful hits a service has -### func (\*Service) [TotalHitsSince](/src/target/hits.go?s=2134:2197#L71) +### func (\*Service) [TotalHitsSince](https://github.com/hunterlong/statup/tree/master/core/hits.go?s=2134:2197#L71) ``` go func (s *Service) TotalHitsSince(ago time.Time) (uint64, error) ``` @@ -1225,7 +1225,7 @@ TotalHitsSince returns the total amount of hits based on a specific time/date -### func (\*Service) [TotalUptime](/src/target/services.go?s=8292:8330#L289) +### func (\*Service) [TotalUptime](https://github.com/hunterlong/statup/tree/master/core/services.go?s=8292:8330#L289) ``` go func (s *Service) TotalUptime() string ``` @@ -1234,7 +1234,7 @@ TotalUptime returns the total uptime percent of a service -### func (\*Service) [Update](/src/target/services.go?s=9766:9810#L342) +### func (\*Service) [Update](https://github.com/hunterlong/statup/tree/master/core/services.go?s=9766:9810#L342) ``` go func (u *Service) Update(restart bool) error ``` @@ -1243,7 +1243,7 @@ Update will update a service in the database, the service's checking routine can -### func (\*Service) [UpdateSingle](/src/target/services.go?s=9541:9598#L337) +### func (\*Service) [UpdateSingle](https://github.com/hunterlong/statup/tree/master/core/services.go?s=9541:9598#L337) ``` go func (u *Service) UpdateSingle(attr ...interface{}) error ``` @@ -1252,7 +1252,7 @@ UpdateSingle will update a single column for a service -## type [ServiceOrder](/src/target/core.go?s=4393:4435#L158) +## type [ServiceOrder](https://github.com/hunterlong/statup/tree/master/core/core.go?s=4393:4435#L158) ``` go type ServiceOrder []types.ServiceInterface ``` @@ -1267,28 +1267,28 @@ ServiceOrder will reorder the services based on 'order_id' (Order) -### func (ServiceOrder) [Len](/src/target/core.go?s=4437:4468#L160) +### func (ServiceOrder) [Len](https://github.com/hunterlong/statup/tree/master/core/core.go?s=4437:4468#L160) ``` go func (c ServiceOrder) Len() int ``` -### func (ServiceOrder) [Less](/src/target/core.go?s=4567:4608#L162) +### func (ServiceOrder) [Less](https://github.com/hunterlong/statup/tree/master/core/core.go?s=4567:4608#L162) ``` go func (c ServiceOrder) Less(i, j int) bool ``` -### func (ServiceOrder) [Swap](/src/target/core.go?s=4497:4533#L161) +### func (ServiceOrder) [Swap](https://github.com/hunterlong/statup/tree/master/core/core.go?s=4497:4533#L161) ``` go func (c ServiceOrder) Swap(i, j int) ``` -## type [User](/src/target/users.go?s=819:852#L26) +## type [User](https://github.com/hunterlong/statup/tree/master/core/users.go?s=819:852#L26) ``` go type User struct { *types.User @@ -1301,7 +1301,7 @@ type User struct { -### func [AuthUser](/src/target/users.go?s=2574:2628#L92) +### func [AuthUser](https://github.com/hunterlong/statup/tree/master/core/users.go?s=2574:2628#L92) ``` go func AuthUser(username, password string) (*User, bool) ``` @@ -1309,28 +1309,28 @@ AuthUser will return the User and a boolean if authentication was correct. AuthUser accepts username, and password as a string -### func [ReturnUser](/src/target/users.go?s=911:947#L31) +### func [ReturnUser](https://github.com/hunterlong/statup/tree/master/core/users.go?s=911:947#L31) ``` go func ReturnUser(u *types.User) *User ``` ReturnUser returns *core.User based off a *types.User -### func [SelectAllUsers](/src/target/users.go?s=2229:2267#L81) +### func [SelectAllUsers](https://github.com/hunterlong/statup/tree/master/core/users.go?s=2229:2267#L81) ``` go func SelectAllUsers() ([]*User, error) ``` SelectAllUsers returns all users -### func [SelectUser](/src/target/users.go?s=1025:1065#L36) +### func [SelectUser](https://github.com/hunterlong/statup/tree/master/core/users.go?s=1025:1065#L36) ``` go func SelectUser(id int64) (*User, error) ``` SelectUser returns the User based on the user's ID. -### func [SelectUsername](/src/target/users.go?s=1206:1257#L43) +### func [SelectUsername](https://github.com/hunterlong/statup/tree/master/core/users.go?s=1206:1257#L43) ``` go func SelectUsername(username string) (*User, error) ``` @@ -1340,7 +1340,7 @@ SelectUser returns the User based on the user's username -### func (\*User) [AfterFind](/src/target/database.go?s=3215:3253#L111) +### func (\*User) [AfterFind](https://github.com/hunterlong/statup/tree/master/core/database.go?s=3215:3253#L111) ``` go func (u *User) AfterFind() (err error) ``` @@ -1349,7 +1349,7 @@ AfterFind for USer will set the timezone -### func (\*User) [BeforeCreate](/src/target/database.go?s=4056:4097#L145) +### func (\*User) [BeforeCreate](https://github.com/hunterlong/statup/tree/master/core/database.go?s=4056:4097#L145) ``` go func (u *User) BeforeCreate() (err error) ``` @@ -1358,7 +1358,7 @@ BeforeCreate for User will set CreatedAt to UTC -### func (\*User) [Create](/src/target/users.go?s=1790:1828#L64) +### func (\*User) [Create](https://github.com/hunterlong/statup/tree/master/core/users.go?s=1790:1828#L64) ``` go func (u *User) Create() (int64, error) ``` @@ -1367,7 +1367,7 @@ Create will insert a new user into the database -### func (\*User) [Delete](/src/target/users.go?s=1434:1463#L51) +### func (\*User) [Delete](https://github.com/hunterlong/statup/tree/master/core/users.go?s=1434:1463#L51) ``` go func (u *User) Delete() error ``` @@ -1376,7 +1376,7 @@ Delete will remove the user record from the database -### func (\*User) [Update](/src/target/users.go?s=1555:1584#L56) +### func (\*User) [Update](https://github.com/hunterlong/statup/tree/master/core/users.go?s=1555:1584#L56) ``` go func (u *User) Update() error ``` @@ -1389,5 +1389,1079 @@ Update will update the user's record in database -- - - -Generated by [godoc2md](http://godoc.org/github.com/davecheney/godoc2md) + + +> cmd +Package main for building the Statup CLI binary application. This package +connects to all the other packages to make a runnable binary for multiple +operating system. + +To build Statup from source, run the follow command in the root directory: +// go build -o statup ./cmd + +Remember that you'll need to compile the static assets using Rice: +// cd source && rice embed-go + +More info on: https://github.com/hunterlong/statup + + + + + + + + +# handlers +`import "github.com/hunterlong/statup/handlers"` + +* [Overview](#pkg-overview) +* [Index](#pkg-index) + +## Overview +Package handlers contains the HTTP server along with the requests and routes. All HTTP related +functions are in this package. + +More info on: https://github.com/hunterlong/statup + + + + +## Index +* [func DesktopInit(ip string, port int)](#DesktopInit) +* [func IsAuthenticated(r *http.Request) bool](#IsAuthenticated) +* [func Router() *mux.Router](#Router) +* [func RunHTTPServer(ip string, port int) error](#RunHTTPServer) +* [type PluginSelect](#PluginSelect) + + +#### Package files +[api.go](https://github.com/hunterlong/statup/tree/master/handlers/api.go) [dashboard.go](https://github.com/hunterlong/statup/tree/master/handlers/dashboard.go) [doc.go](https://github.com/hunterlong/statup/tree/master/handlers/doc.go) [handlers.go](https://github.com/hunterlong/statup/tree/master/handlers/handlers.go) [index.go](https://github.com/hunterlong/statup/tree/master/handlers/index.go) [plugins.go](https://github.com/hunterlong/statup/tree/master/handlers/plugins.go) [prometheus.go](https://github.com/hunterlong/statup/tree/master/handlers/prometheus.go) [routes.go](https://github.com/hunterlong/statup/tree/master/handlers/routes.go) [services.go](https://github.com/hunterlong/statup/tree/master/handlers/services.go) [settings.go](https://github.com/hunterlong/statup/tree/master/handlers/settings.go) [setup.go](https://github.com/hunterlong/statup/tree/master/handlers/setup.go) [users.go](https://github.com/hunterlong/statup/tree/master/handlers/users.go) + + + + + +## func [DesktopInit](https://github.com/hunterlong/statup/tree/master/handlers/index.go?s=1194:1231#L41) +``` go +func DesktopInit(ip string, port int) +``` + + +## func [IsAuthenticated](https://github.com/hunterlong/statup/tree/master/handlers/handlers.go?s=2049:2091#L68) +``` go +func IsAuthenticated(r *http.Request) bool +``` +IsAuthenticated returns true if the HTTP request is authenticated. You can set the environment variable GO_ENV=test +to bypass the admin authenticate to the dashboard features. + + + +## func [Router](https://github.com/hunterlong/statup/tree/master/handlers/routes.go?s=980:1005#L34) +``` go +func Router() *mux.Router +``` +Router returns all of the routes used in Statup + + + +## func [RunHTTPServer](https://github.com/hunterlong/statup/tree/master/handlers/handlers.go?s=1141:1186#L43) +``` go +func RunHTTPServer(ip string, port int) error +``` +RunHTTPServer will start a HTTP server on a specific IP and port + + + + +## type [PluginSelect](https://github.com/hunterlong/statup/tree/master/handlers/plugins.go?s=725:814#L23) +``` go +type PluginSelect struct { + Plugin string + Form string + Params map[string]interface{} +} + +``` + + + + + + + + + + + + + + + +# notifiers +`import "github.com/hunterlong/statup/notifiers"` + +* [Overview](#pkg-overview) +* [Index](#pkg-index) + +## Overview +Package notifiers holds all the notifiers for Statup, which also includes +user created notifiers that have been accepted in a Push Request. Read the wiki +to see a full example of a notifier with all events, visit Statup's +notifier example code: https://github.com/hunterlong/statup/wiki/Notifier-Example + +This package shouldn't contain any exports, to see how notifiers work +visit the core/notifier package at: https://godoc.org/github.com/hunterlong/statup/core/notifier +and learn how to create your own custom notifier. + + + + +## Index + + +#### Package files +[discord.go](https://github.com/hunterlong/statup/tree/master/notifiers/discord.go) [doc.go](https://github.com/hunterlong/statup/tree/master/notifiers/doc.go) [email.go](https://github.com/hunterlong/statup/tree/master/notifiers/email.go) [line_notify.go](https://github.com/hunterlong/statup/tree/master/notifiers/line_notify.go) [slack.go](https://github.com/hunterlong/statup/tree/master/notifiers/slack.go) [twilio.go](https://github.com/hunterlong/statup/tree/master/notifiers/twilio.go) [webhook.go](https://github.com/hunterlong/statup/tree/master/notifiers/webhook.go) + + + + + + + + + + + + +# source +`import "github.com/hunterlong/statup/source"` + +* [Overview](#pkg-overview) +* [Index](#pkg-index) + +## Overview +Package source holds all the assets for Statup. This includes +CSS, JS, SCSS, HTML and other website related content. +This package uses Rice to compile all assets into a single 'rice-box.go' file. + +To compile all the assets run `rice embed-go` in the source directory. + +More info on: https://github.com/hunterlong/statup + + + + +## Index +* [Variables](#pkg-variables) +* [func Assets()](#Assets) +* [func CompileSASS(folder string) error](#CompileSASS) +* [func CopyToPublic(box *rice.Box, folder, file string) error](#CopyToPublic) +* [func CreateAllAssets(folder string) error](#CreateAllAssets) +* [func DeleteAllAssets(folder string) error](#DeleteAllAssets) +* [func HelpMarkdown() string](#HelpMarkdown) +* [func MakePublicFolder(folder string) error](#MakePublicFolder) +* [func OpenAsset(folder, file string) string](#OpenAsset) +* [func SaveAsset(data []byte, folder, file string) error](#SaveAsset) +* [func UsingAssets(folder string) bool](#UsingAssets) + + +#### Package files +[doc.go](https://github.com/hunterlong/statup/tree/master/source/doc.go) [rice-box.go](https://github.com/hunterlong/statup/tree/master/source/rice-box.go) [source.go](https://github.com/hunterlong/statup/tree/master/source/source.go) + + + +## Variables +``` go +var ( + CssBox *rice.Box // CSS files from the 'source/css' directory, this will be loaded into '/assets/css' + ScssBox *rice.Box // SCSS files from the 'source/scss' directory, this will be loaded into '/assets/scss' + JsBox *rice.Box // JS files from the 'source/js' directory, this will be loaded into '/assets/js' + TmplBox *rice.Box // HTML and other small files from the 'source/tmpl' directory, this will be loaded into '/assets' +) +``` + + +## func [Assets](https://github.com/hunterlong/statup/tree/master/source/source.go?s=1380:1393#L38) +``` go +func Assets() +``` +Assets will load the Rice boxes containing the CSS, SCSS, JS, and HTML files. + + + +## func [CompileSASS](https://github.com/hunterlong/statup/tree/master/source/source.go?s=1872:1909#L57) +``` go +func CompileSASS(folder string) error +``` +CompileSASS will attempt to compile the SASS files into CSS + + + +## func [CopyToPublic](https://github.com/hunterlong/statup/tree/master/source/source.go?s=6311:6370#L190) +``` go +func CopyToPublic(box *rice.Box, folder, file string) error +``` +CopyToPublic will create a file from a rice Box to the '/assets' directory + + + +## func [CreateAllAssets](https://github.com/hunterlong/statup/tree/master/source/source.go?s=4588:4629#L152) +``` go +func CreateAllAssets(folder string) error +``` +CreateAllAssets will dump HTML, CSS, SCSS, and JS assets into the '/assets' directory + + + +## func [DeleteAllAssets](https://github.com/hunterlong/statup/tree/master/source/source.go?s=5969:6010#L179) +``` go +func DeleteAllAssets(folder string) error +``` +DeleteAllAssets will delete the '/assets' folder + + + +## func [HelpMarkdown](https://github.com/hunterlong/statup/tree/master/source/source.go?s=1599:1625#L46) +``` go +func HelpMarkdown() string +``` +HelpMarkdown will return the Markdown of help.md into HTML + + + +## func [MakePublicFolder](https://github.com/hunterlong/statup/tree/master/source/source.go?s=6878:6920#L207) +``` go +func MakePublicFolder(folder string) error +``` +MakePublicFolder will create a new folder + + + +## func [OpenAsset](https://github.com/hunterlong/statup/tree/master/source/source.go?s=4278:4320#L142) +``` go +func OpenAsset(folder, file string) string +``` +OpenAsset returns a file's contents as a string + + + +## func [SaveAsset](https://github.com/hunterlong/statup/tree/master/source/source.go?s=3910:3964#L131) +``` go +func SaveAsset(data []byte, folder, file string) error +``` +SaveAsset will save an asset to the '/assets/' folder. + + + +## func [UsingAssets](https://github.com/hunterlong/statup/tree/master/source/source.go?s=3365:3401#L111) +``` go +func UsingAssets(folder string) bool +``` +UsingAssets returns true if the '/assets' folder is found in the directory + + + + + + + + + + +# types +`import "github.com/hunterlong/statup/types"` + +* [Overview](#pkg-overview) +* [Index](#pkg-index) + +## Overview +Package types contains all of the structs for objects in Statup including services, hits, failures, Core, and others. + +More info on: https://github.com/hunterlong/statup + + + + +## Index +* [Constants](#pkg-constants) +* [Variables](#pkg-variables) +* [type AllNotifiers](#AllNotifiers) +* [type Checkin](#Checkin) +* [type CheckinHit](#CheckinHit) +* [type Core](#Core) +* [type CoreInterface](#CoreInterface) +* [type DbConfig](#DbConfig) +* [type Failure](#Failure) +* [type FailureInterface](#FailureInterface) +* [type Hit](#Hit) +* [type Info](#Info) +* [type PluginActions](#PluginActions) +* [type PluginInfo](#PluginInfo) +* [type PluginJSON](#PluginJSON) +* [type PluginRepos](#PluginRepos) +* [type Routing](#Routing) +* [type Service](#Service) + * [func (s *Service) Close()](#Service.Close) + * [func (s *Service) IsRunning() bool](#Service.IsRunning) + * [func (s *Service) Start()](#Service.Start) +* [type ServiceInterface](#ServiceInterface) +* [type User](#User) +* [type UserInterface](#UserInterface) + + +#### Package files +[checkin.go](https://github.com/hunterlong/statup/tree/master/types/checkin.go) [core.go](https://github.com/hunterlong/statup/tree/master/types/core.go) [doc.go](https://github.com/hunterlong/statup/tree/master/types/doc.go) [failure.go](https://github.com/hunterlong/statup/tree/master/types/failure.go) [service.go](https://github.com/hunterlong/statup/tree/master/types/service.go) [time.go](https://github.com/hunterlong/statup/tree/master/types/time.go) [types.go](https://github.com/hunterlong/statup/tree/master/types/types.go) [user.go](https://github.com/hunterlong/statup/tree/master/types/user.go) + + +## Constants +``` go +const ( + TIME_NANOZ = "2006-01-02 15:04:05.999999-0700 MST" + TIME_NANO = "2006-01-02T15:04:05Z" + TIME = "2006-01-02 15:04:05" + TIME_DAY = "2006-01-02" +) +``` + +## Variables +``` go +var ( + NOW = func() time.Time { return time.Now() }() + HOUR_1_AGO = time.Now().Add(-1 * time.Hour) + HOUR_24_AGO = time.Now().Add(-24 * time.Hour) + HOUR_72_AGO = time.Now().Add(-72 * time.Hour) + DAY_7_AGO = NOW.AddDate(0, 0, -7) + MONTH_1_AGO = NOW.AddDate(0, -1, 0) + YEAR_1_AGO = NOW.AddDate(-1, 0, 0) +) +``` + + + +## type [AllNotifiers](https://github.com/hunterlong/statup/tree/master/types/core.go?s=707:736#L22) +``` go +type AllNotifiers interface{} +``` + + + + + + + + + +## type [Checkin](https://github.com/hunterlong/statup/tree/master/types/checkin.go?s=707:1126#L22) +``` go +type Checkin struct { + Id int64 `gorm:"primary_key;column:id"` + Service int64 `gorm:"index;column:service"` + Interval int64 `gorm:"column:check_interval"` + GracePeriod int64 `gorm:"column:grace_period"` + ApiKey string `gorm:"column:api_key"` + CreatedAt time.Time `gorm:"column:created_at" json:"created_at"` + UpdatedAt time.Time `gorm:"column:updated_at" json:"updated_at"` +} + +``` + + + + + + + + + +## type [CheckinHit](https://github.com/hunterlong/statup/tree/master/types/checkin.go?s=1128:1374#L32) +``` go +type CheckinHit struct { + Id int64 `gorm:"primary_key;column:id"` + Checkin int64 `gorm:"index;column:checkin"` + From string `gorm:"column:from_location"` + CreatedAt time.Time `gorm:"column:created_at" json:"created_at"` +} + +``` + + + + + + + + + +## type [Core](https://github.com/hunterlong/statup/tree/master/types/core.go?s=990:2624#L27) +``` go +type Core struct { + Name string `gorm:"not null;column:name" json:"name"` + Description string `gorm:"not null;column:description" json:"description,omitempty"` + Config string `gorm:"column:config" json:"-"` + ApiKey string `gorm:"column:api_key" json:"-"` + ApiSecret string `gorm:"column:api_secret" json:"-"` + Style string `gorm:"not null;column:style" json:"style,omitempty"` + Footer string `gorm:"not null;column:footer" json:"footer,omitempty"` + Domain string `gorm:"not null;column:domain" json:"domain,omitempty"` + Version string `gorm:"column:version" json:"version"` + MigrationId int64 `gorm:"column:migration_id" json:"migration_id,omitempty"` + UseCdn bool `gorm:"column:use_cdn;default:false" json:"using_cdn,omitempty"` + Timezone float32 `gorm:"column:timezone;default:-8.0" json:"timezone,omitempty"` + CreatedAt time.Time `gorm:"column:created_at" json:"created_at"` + UpdatedAt time.Time `gorm:"column:updated_at" json:"updated_at"` + DbConnection string `gorm:"-" json:"database"` + Started time.Time `gorm:"-" json:"started_on"` + Services []ServiceInterface `gorm:"-" json:"services,omitempty"` + Plugins []Info `gorm:"-" json:"-"` + Repos []PluginJSON `gorm:"-" json:"-"` + AllPlugins []PluginActions `gorm:"-" json:"-"` + Notifications []AllNotifiers `gorm:"-" json:"-"` + CoreInterface `gorm:"-" json:"-"` +} + +``` +Core struct contains all the required fields for Statup. All application settings +will be saved into 1 row in the 'core' table. You can use the core.CoreApp +global variable to interact with the attributes to the application, such as services. + + + + + + + + + + +## type [CoreInterface](https://github.com/hunterlong/statup/tree/master/types/core.go?s=2626:2766#L52) +``` go +type CoreInterface interface { + SelectAllServices() ([]*Service, error) + Count24HFailures() uint64 + ServicesCount() int + CountOnline() int +} +``` + + + + + + + + + +## type [DbConfig](https://github.com/hunterlong/statup/tree/master/types/types.go?s=1166:1740#L34) +``` go +type DbConfig struct { + DbConn string `yaml:"connection"` + DbHost string `yaml:"host"` + DbUser string `yaml:"user"` + DbPass string `yaml:"password"` + DbData string `yaml:"database"` + DbPort int `yaml:"port"` + ApiKey string `yaml:"api_key"` + ApiSecret string `yaml:"api_secret"` + Project string `yaml:"-"` + Description string `yaml:"-"` + Domain string `yaml:"-"` + Username string `yaml:"-"` + Password string `yaml:"-"` + Email string `yaml:"-"` + Error error `yaml:"-"` + Location string `yaml:"location"` +} + +``` +DbConfig struct is used for the database connection and creates the 'config.yml' file + + + + + + + + + + +## type [Failure](https://github.com/hunterlong/statup/tree/master/types/failure.go?s=862:1324#L24) +``` go +type Failure struct { + Id int64 `gorm:"primary_key;column:id" json:"id"` + Issue string `gorm:"column:issue" json:"issue"` + Method string `gorm:"column:method" json:"method,omitempty"` + Service int64 `gorm:"index;column:service" json:"-"` + PingTime float64 `gorm:"column:ping_time"` + CreatedAt time.Time `gorm:"column:created_at" json:"created_at"` + FailureInterface `gorm:"-" json:"-"` +} + +``` +Failure is a failed attempt to check a service. Any a service does not meet the expected requirements, +a new Failure will be inserted into database. + + + + + + + + + + +## type [FailureInterface](https://github.com/hunterlong/statup/tree/master/types/failure.go?s=1326:1511#L34) +``` go +type FailureInterface interface { + Ago() string // Ago returns a human readble timestamp + ParseError() string // ParseError returns a human readable error for a service failure +} +``` + + + + + + + + + +## type [Hit](https://github.com/hunterlong/statup/tree/master/types/types.go?s=819:1075#L25) +``` go +type Hit struct { + Id int64 `gorm:"primary_key;column:id"` + Service int64 `gorm:"column:service"` + Latency float64 `gorm:"column:latency"` + PingTime float64 `gorm:"column:ping_time"` + CreatedAt time.Time `gorm:"column:created_at"` +} + +``` +Hit struct is a 'successful' ping or web response entry for a service. + + + + + + + + + + +## type [Info](https://github.com/hunterlong/statup/tree/master/types/types.go?s=1742:1822#L53) +``` go +type Info struct { + Name string + Description string + Form string +} + +``` + + + + + + + + + +## type [PluginActions](https://github.com/hunterlong/statup/tree/master/types/types.go?s=1985:2596#L70) +``` go +type PluginActions interface { + GetInfo() Info + GetForm() string + OnLoad(db gorm.DB) + SetInfo(map[string]interface{}) Info + Routes() []Routing + OnSave(map[string]interface{}) + OnFailure(map[string]interface{}) + OnSuccess(map[string]interface{}) + OnSettingsSaved(map[string]interface{}) + OnNewUser(map[string]interface{}) + OnNewService(map[string]interface{}) + OnUpdatedService(map[string]interface{}) + OnDeletedService(map[string]interface{}) + OnInstall(map[string]interface{}) + OnUninstall(map[string]interface{}) + OnBeforeRequest(map[string]interface{}) + OnAfterRequest(map[string]interface{}) + OnShutdown() +} +``` + + + + + + + + + +## type [PluginInfo](https://github.com/hunterlong/statup/tree/master/types/types.go?s=1824:1876#L59) +``` go +type PluginInfo struct { + Info Info + PluginActions +} + +``` + + + + + + + + + +## type [PluginJSON](https://github.com/hunterlong/statup/tree/master/types/types.go?s=2649:2859#L95) +``` go +type PluginJSON struct { + Name string `json:"name"` + Description string `json:"description"` + Repo string `json:"repo"` + Author string `json:"author"` + Namespace string `json:"namespace"` +} + +``` + + + + + + + + + +## type [PluginRepos](https://github.com/hunterlong/statup/tree/master/types/types.go?s=2598:2647#L91) +``` go +type PluginRepos struct { + Plugins []PluginJSON +} + +``` + + + + + + + + + +## type [Routing](https://github.com/hunterlong/statup/tree/master/types/types.go?s=1878:1983#L64) +``` go +type Routing struct { + URL string + Method string + Handler func(http.ResponseWriter, *http.Request) +} + +``` + + + + + + + + + +## type [Service](https://github.com/hunterlong/statup/tree/master/types/service.go?s=707:2484#L22) +``` go +type Service struct { + Id int64 `gorm:"primary_key;column:id" json:"id"` + Name string `gorm:"column:name" json:"name"` + Domain string `gorm:"column:domain" json:"domain"` + Expected string `gorm:"not null;column:expected" json:"expected"` + ExpectedStatus int `gorm:"default:200;column:expected_status" json:"expected_status"` + Interval int `gorm:"default:30;column:check_interval" json:"check_interval"` + Type string `gorm:"column:check_type" json:"type"` + Method string `gorm:"column:method" json:"method"` + PostData string `gorm:"not null;column:post_data" json:"post_data"` + Port int `gorm:"not null;column:port" json:"port"` + Timeout int `gorm:"default:30;column:timeout" json:"timeout"` + Order int `gorm:"default:0;column:order_id" json:"order_id"` + CreatedAt time.Time `gorm:"column:created_at" json:"created_at"` + UpdatedAt time.Time `gorm:"column:updated_at" json:"updated_at"` + Online bool `gorm:"-" json:"online"` + Latency float64 `gorm:"-" json:"latency"` + PingTime float64 `gorm:"-" json:"ping_time"` + Online24Hours float32 `gorm:"-" json:"24_hours_online"` + AvgResponse string `gorm:"-" json:"avg_response"` + Running chan bool `gorm:"-" json:"-"` + Checkpoint time.Time `gorm:"-" json:"-"` + SleepDuration time.Duration `gorm:"-" json:"-"` + LastResponse string `gorm:"-" json:"-"` + LastStatusCode int `gorm:"-" json:"status_code"` + LastOnline time.Time `gorm:"-" json:"last_online"` + Failures []interface{} `gorm:"-" json:"failures,omitempty"` +} + +``` + + + + + + + + + +### func (\*Service) [Close](https://github.com/hunterlong/statup/tree/master/types/service.go?s=2844:2869#L66) +``` go +func (s *Service) Close() +``` +Close will stop the go routine that is checking if service is online or not + + + + +### func (\*Service) [IsRunning](https://github.com/hunterlong/statup/tree/master/types/service.go?s=2980:3014#L73) +``` go +func (s *Service) IsRunning() bool +``` +IsRunning returns true if the service go routine is running + + + + +### func (\*Service) [Start](https://github.com/hunterlong/statup/tree/master/types/service.go?s=2705:2730#L61) +``` go +func (s *Service) Start() +``` +Start will create a channel for the service checking go routine + + + + +## type [ServiceInterface](https://github.com/hunterlong/statup/tree/master/types/service.go?s=2486:2636#L51) +``` go +type ServiceInterface interface { + Select() *Service + CheckQueue(bool) + Check(bool) + Create(bool) (int64, error) + Update(bool) error + Delete() error +} +``` + + + + + + + + + +## type [User](https://github.com/hunterlong/statup/tree/master/types/user.go?s=707:1393#L22) +``` go +type User struct { + Id int64 `gorm:"primary_key;column:id" json:"id"` + Username string `gorm:"type:varchar(100);unique;column:username;" json:"username"` + Password string `gorm:"column:password" json:"-"` + Email string `gorm:"type:varchar(100);unique;column:email" json:"-"` + ApiKey string `gorm:"column:api_key" json:"api_key"` + ApiSecret string `gorm:"column:api_secret" json:"-"` + Admin bool `gorm:"column:administrator" json:"admin"` + CreatedAt time.Time `gorm:"column:created_at" json:"created_at"` + UpdatedAt time.Time `gorm:"column:updated_at" json:"updated_at"` + UserInterface `gorm:"-" json:"-"` +} + +``` + + + + + + + + + +## type [UserInterface](https://github.com/hunterlong/statup/tree/master/types/user.go?s=1395:1507#L35) +``` go +type UserInterface interface { + // Database functions + Create() (int64, error) + Update() error + Delete() error +} +``` + + + + + + + + + + + + + + + +# utils +`import "github.com/hunterlong/statup/utils"` + +* [Overview](#pkg-overview) +* [Index](#pkg-index) + +## Overview +Package utils contains common methods used in most packages in Statup. +This package contains multiple function like: +Logging, encryption, type conversions, setting utils.Directory as the current directory, +running local CMD commands, and creaing/deleting files/folder. + +You can overwrite the utils.Directory global variable by including +STATUP_DIR environment variable to be an absolute path. + +More info on: https://github.com/hunterlong/statup + + + + +## Index +* [Variables](#pkg-variables) +* [func Command(cmd string) (string, string, error)](#Command) +* [func DeleteDirectory(directory string) error](#DeleteDirectory) +* [func DeleteFile(file string) error](#DeleteFile) +* [func DurationReadable(d time.Duration) string](#DurationReadable) +* [func FileExists(name string) bool](#FileExists) +* [func FormatDuration(d time.Duration) string](#FormatDuration) +* [func HashPassword(password string) string](#HashPassword) +* [func Http(r *http.Request) string](#Http) +* [func InitLogs() error](#InitLogs) +* [func Log(level int, err interface{}) error](#Log) +* [func NewSHA1Hash(n ...int) string](#NewSHA1Hash) +* [func RandomString(n int) string](#RandomString) +* [func StringInt(s string) int64](#StringInt) +* [func Timezoner(t time.Time, zone float32) time.Time](#Timezoner) +* [func ToString(s interface{}) string](#ToString) +* [func UnderScoreString(str string) string](#UnderScoreString) +* [type LogRow](#LogRow) + * [func GetLastLine() *LogRow](#GetLastLine) + * [func (o *LogRow) FormatForHtml() string](#LogRow.FormatForHtml) +* [type Timestamp](#Timestamp) + * [func (t Timestamp) Ago() string](#Timestamp.Ago) +* [type Timestamper](#Timestamper) + + +#### Package files +[doc.go](https://github.com/hunterlong/statup/tree/master/utils/doc.go) [encryption.go](https://github.com/hunterlong/statup/tree/master/utils/encryption.go) [log.go](https://github.com/hunterlong/statup/tree/master/utils/log.go) [time.go](https://github.com/hunterlong/statup/tree/master/utils/time.go) [utils.go](https://github.com/hunterlong/statup/tree/master/utils/utils.go) + + + +## Variables +``` go +var ( + LastLines []*LogRow + LockLines sync.Mutex +) +``` +``` go +var ( + Directory string +) +``` + + +## func [Command](https://github.com/hunterlong/statup/tree/master/utils/utils.go?s=3477:3525#L146) +``` go +func Command(cmd string) (string, string, error) +``` +Command will run a terminal command with 'sh -c COMMAND' and return stdout and errOut as strings + + + +## func [DeleteDirectory](https://github.com/hunterlong/statup/tree/master/utils/utils.go?s=3295:3339#L141) +``` go +func DeleteDirectory(directory string) error +``` +DeleteDirectory will attempt to delete a directory and all contents inside + + + +## func [DeleteFile](https://github.com/hunterlong/statup/tree/master/utils/utils.go?s=3076:3110#L131) +``` go +func DeleteFile(file string) error +``` +DeleteFile will attempt to delete a file + + + +## func [DurationReadable](https://github.com/hunterlong/statup/tree/master/utils/utils.go?s=4663:4708#L200) +``` go +func DurationReadable(d time.Duration) string +``` + + +## func [FileExists](https://github.com/hunterlong/statup/tree/master/utils/utils.go?s=2889:2922#L121) +``` go +func FileExists(name string) bool +``` +FileExists returns true if a file exists + + + +## func [FormatDuration](https://github.com/hunterlong/statup/tree/master/utils/time.go?s=714:757#L23) +``` go +func FormatDuration(d time.Duration) string +``` + + +## func [HashPassword](https://github.com/hunterlong/statup/tree/master/utils/encryption.go?s=825:866#L26) +``` go +func HashPassword(password string) string +``` +HashPassword returns the bcrypt hash of a password string + + + +## func [Http](https://github.com/hunterlong/statup/tree/master/utils/log.go?s=3070:3103#L126) +``` go +func Http(r *http.Request) string +``` +Http returns a log for a HTTP request + + + +## func [InitLogs](https://github.com/hunterlong/statup/tree/master/utils/log.go?s=1415:1436#L58) +``` go +func InitLogs() error +``` +InitLogs will create the '/logs' directory and creates a file '/logs/statup.log' for application logging + + + +## func [Log](https://github.com/hunterlong/statup/tree/master/utils/log.go?s=2191:2233#L93) +``` go +func Log(level int, err interface{}) error +``` +Log creates a new entry in the Logger. Log has 1-5 levels depending on how critical the log/error is + + + +## func [NewSHA1Hash](https://github.com/hunterlong/statup/tree/master/utils/encryption.go?s=1026:1059#L32) +``` go +func NewSHA1Hash(n ...int) string +``` +NewSHA1Hash returns a random SHA1 hash based on a specific length + + + +## func [RandomString](https://github.com/hunterlong/statup/tree/master/utils/encryption.go?s=1439:1470#L47) +``` go +func RandomString(n int) string +``` +RandomString generates a random string of n length + + + +## func [StringInt](https://github.com/hunterlong/statup/tree/master/utils/utils.go?s=1100:1130#L45) +``` go +func StringInt(s string) int64 +``` +StringInt converts a string to an int64 + + + +## func [Timezoner](https://github.com/hunterlong/statup/tree/master/utils/utils.go?s=1530:1581#L69) +``` go +func Timezoner(t time.Time, zone float32) time.Time +``` + + +## func [ToString](https://github.com/hunterlong/statup/tree/master/utils/utils.go?s=1221:1256#L51) +``` go +func ToString(s interface{}) string +``` +ToString converts a int to a string + + + +## func [UnderScoreString](https://github.com/hunterlong/statup/tree/master/utils/utils.go?s=2204:2244#L97) +``` go +func UnderScoreString(str string) string +``` +UnderScoreString will return a string that replaces spaces and other characters to underscores + + + + +## type [LogRow](https://github.com/hunterlong/statup/tree/master/utils/log.go?s=3739:3795#L154) +``` go +type LogRow struct { + Date time.Time + Line interface{} +} + +``` + + + + + + +### func [GetLastLine](https://github.com/hunterlong/statup/tree/master/utils/log.go?s=3586:3612#L145) +``` go +func GetLastLine() *LogRow +``` +GetLastLine returns 1 line for a recent log entry + + + + + +### func (\*LogRow) [FormatForHtml](https://github.com/hunterlong/statup/tree/master/utils/log.go?s=4105:4144#L178) +``` go +func (o *LogRow) FormatForHtml() string +``` + + + +## type [Timestamp](https://github.com/hunterlong/statup/tree/master/utils/utils.go?s=1838:1862#L85) +``` go +type Timestamp time.Time +``` + + + + + + + + + +### func (Timestamp) [Ago](https://github.com/hunterlong/statup/tree/master/utils/utils.go?s=1996:2027#L91) +``` go +func (t Timestamp) Ago() string +``` +Ago returns a human readable timestamp based on the Timestamp (time.Time) interface + + + + +## type [Timestamper](https://github.com/hunterlong/statup/tree/master/utils/utils.go?s=1863:1907#L86) +``` go +type Timestamper interface { + Ago() string +} +``` + + + + + + + + + + + + +
github.com/hunterlong/statup/cmd31.37%48/153
github.com/hunterlong/statup/core53.01%485/915
github.com/hunterlong/statup/core/notifier72.73%152/209