statping/types/types.go

121 lines
3.5 KiB
Go
Raw Normal View History

2018-06-23 04:17:57 +00:00
package types
2018-06-30 00:57:05 +00:00
import (
"time"
)
2018-07-14 02:37:39 +00:00
type Service struct {
Id int64 `db:"id,omitempty" json:"id"`
Name string `db:"name" json:"name"`
Domain string `db:"domain" json:"domain"`
Expected string `db:"expected" json:"expected"`
ExpectedStatus int `db:"expected_status" json:"expected_status"`
Interval int `db:"check_interval" json:"check_interval"`
Type string `db:"check_type" json:"type"`
Method string `db:"method" json:"method"`
PostData string `db:"post_data" json:"post_data"`
Port int `db:"port" json:"port"`
CreatedAt time.Time `db:"created_at" json:"created_at"`
Online bool `json:"online"`
Latency float64 `json:"latency"`
Online24Hours float32 `json:"24_hours_online"`
AvgResponse string `json:"avg_response"`
TotalUptime string `json:"uptime"`
OrderId int64 `json:"order_id"`
Failures []*Failure `json:"failures"`
Checkins []*Checkin `json:"checkins"`
StopRoutine chan struct{}
LastResponse string
LastStatusCode int
LastOnline time.Time
DnsLookup float64 `json:"dns_lookup_time"`
}
2018-06-30 00:57:05 +00:00
type User struct {
Id int64 `db:"id,omitempty" json:"id"`
Username string `db:"username" json:"username"`
Password string `db:"password" json:"-"`
Email string `db:"email" json:"-"`
ApiKey string `db:"api_key" json:"api_key"`
ApiSecret string `db:"api_secret" json:"-"`
Admin bool `db:"administrator" json:"admin"`
CreatedAt time.Time `db:"created_at" json:"created_at"`
}
type Hit struct {
Id int `db:"id,omitempty"`
Service int64 `db:"service"`
Latency float64 `db:"latency"`
CreatedAt time.Time `db:"created_at"`
}
type Failure struct {
Id int `db:"id,omitempty" json:"id"`
Issue string `db:"issue" json:"issue"`
Method string `db:"method" json:"method,omitempty"`
Service int64 `db:"service" json:"service_id"`
CreatedAt time.Time `db:"created_at" json:"created_at"`
2018-06-30 00:57:05 +00:00
}
type Checkin struct {
Id int `db:"id,omitempty"`
Service int64 `db:"service"`
Interval int64 `db:"check_interval"`
Api string `db:"api"`
CreatedAt time.Time `db:"created_at"`
Hits int64 `json:"hits"`
Last time.Time `json:"last"`
}
2018-06-23 04:17:57 +00:00
type Email struct {
To string
Subject string
Template string
2018-07-02 06:21:41 +00:00
From string
2018-06-23 04:17:57 +00:00
Data interface{}
2018-07-02 06:21:41 +00:00
Source string
Sent bool
2018-06-23 04:17:57 +00:00
}
2018-06-30 00:57:05 +00:00
type Config struct {
Connection string `yaml:"connection"`
Host string `yaml:"host"`
Database string `yaml:"database"`
User string `yaml:"user"`
Password string `yaml:"password"`
Port string `yaml:"port"`
Secret string `yaml:"secret"`
}
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"`
Project string `yaml:"-"`
Description string `yaml:"-"`
Domain string `yaml:"-"`
Username string `yaml:"-"`
Password string `yaml:"-"`
Email string `yaml:"-"`
Error error `yaml:"-"`
}
type PluginRepos struct {
Plugins []PluginJSON
}
type PluginJSON struct {
Name string `json:"name"`
Description string `json:"description"`
Repo string `json:"repo"`
Author string `json:"author"`
Namespace string `json:"namespace"`
}
type FailureData struct {
Issue string
}