statping/types/checkins/samples.go

43 lines
745 B
Go
Raw Normal View History

2020-03-04 10:29:00 +00:00
package checkins
import (
"github.com/hunterlong/statping/utils"
"time"
)
2020-03-04 14:20:47 +00:00
func Samples() {
2020-03-04 10:29:00 +00:00
checkin1 := &Checkin{
Name: "Example Checkin 1",
ServiceId: 1,
Interval: 300,
GracePeriod: 300,
ApiKey: utils.RandomString(7),
}
2020-03-04 14:20:47 +00:00
checkin1.Create()
2020-03-04 10:29:00 +00:00
checkin2 := &Checkin{
Name: "Example Checkin 2",
ServiceId: 2,
Interval: 900,
GracePeriod: 300,
ApiKey: utils.RandomString(7),
}
2020-03-04 14:20:47 +00:00
checkin2.Create()
2020-03-04 10:29:00 +00:00
}
2020-03-04 14:20:47 +00:00
func SamplesChkHits() {
2020-03-04 10:29:00 +00:00
checkTime := time.Now().UTC().Add(-24 * time.Hour)
for i := int64(1); i <= 2; i++ {
checkHit := &CheckinHit{
Checkin: i,
From: "192.168.0.1",
CreatedAt: checkTime.UTC(),
}
2020-03-04 14:20:47 +00:00
checkHit.Create()
2020-03-04 10:29:00 +00:00
checkTime = checkTime.Add(10 * time.Minute)
}
}