Documentation ¶
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
- Variables
- type AllNotifiers
- type Asseter
- type Checkin
- type CheckinHit
- type Core
- type Databaser
- type DbConfig
- type Failure
- type FailureInterface
- type Hit
- type Info
- type Plugin
- type PluginActions
- type PluginInfo
- type PluginJSON
- type PluginObject
- type PluginRepos
- type PluginRoute
- type PluginRouting
- type Pluginer
- type Router
- type Service
- type ServiceInterface
- type User
- type UserInterface
Constants ¶
const ( TIME_NANO = "2006-01-02T15:04:05Z" TIME = "2006-01-02 15:04:05" TIME_DAY = "2006-01-02" )
Variables ¶
var (
NOW = func() time.Time { return time.Now() }()
)
Functions ¶
This section is empty.
Types ¶
type AllNotifiers ¶ added in v0.79.1
type AllNotifiers interface{}
AllNotifiers contains all the Notifiers loaded
type Checkin ¶ added in v0.27.7
type Checkin struct { Id int64 `gorm:"primary_key;column:id"` ServiceId int64 `gorm:"index;column:service"` Name string `gorm:"column:name"` 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"` Running chan bool `gorm:"-" json:"-"` }
Checkin struct will allow an application to send a recurring HTTP GET to confirm a service is online
func (*Checkin) Close ¶ added in v0.79.1
func (s *Checkin) Close()
Close will stop the checkin routine
type CheckinHit ¶ added in v0.79.1
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"` }
CheckinHit is a successful response from a Checkin
type Core ¶ added in v0.79.1
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"` 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:"-"` }
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 DbConfig ¶ added in v0.27.7
type DbConfig struct { DbConn string `yaml:"connection"` DbHost string `yaml:"host"` DbUser string `yaml:"user"` DbPass string `yaml:"password"` DbData string `yaml:"database"` DbPort int64 `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 ¶ added in v0.27.7
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"` MethodId int64 `gorm:"column:method_id" json:"method_id,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 ¶ added in v0.79.1
type Hit ¶ added in v0.27.7
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 PluginActions ¶ added in v0.79.1
type PluginInfo ¶ added in v0.79.1
type PluginInfo struct { Info *Info Routes []*PluginRoute }
type PluginJSON ¶ added in v0.27.7
type PluginObject ¶ added in v0.79.1
type PluginObject struct {
Pluginer
}
type PluginRepos ¶ added in v0.27.7
type PluginRepos struct {
Plugins []PluginJSON
}
type PluginRoute ¶ added in v0.79.1
type PluginRoute struct { Url string Method string Func http.HandlerFunc }
type PluginRouting ¶ added in v0.79.1
type Router ¶ added in v0.79.1
type Router interface { Routes() []*PluginRoute AddRoute(string, string, http.HandlerFunc) error }
type Service ¶ added in v0.79.1
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:"online_24_hours"` 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"` }
Service is the main struct for Services
func (*Service) Close ¶ added in v0.79.1
func (s *Service) Close()
Close will stop the go routine that is checking if service is online or not
type ServiceInterface ¶ added in v0.79.1
type User ¶ added in v0.27.7
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:"-"` }
User is the main struct for Users