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 Message
- type NullBool
- type NullFloat64
- type NullInt64
- type NullString
- 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"` Version string `gorm:"column:version" json:"version"` MigrationId int64 `gorm:"column:migration_id" json:"migration_id,omitempty"` UseCdn NullBool `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 Message ¶ added in v0.79.4
type Message struct { Id int64 `gorm:"primary_key;column:id" json:"id"` Title string `gorm:"column:title" json:"title"` Description string `gorm:"column:description" json:"description"` StartOn time.Time `gorm:"column:start_on" json:"start_on"` EndOn time.Time `gorm:"column:end_on" json:"end_on"` ServiceId int64 `gorm:"index;column:service" json:"service"` NotifyUsers NullBool `gorm:"column:notify_users" json:"notify_users"` NotifyMethod string `gorm:"column:notify_method" json:"notify_method"` NotifyBefore time.Duration `gorm:"column:notify_before" json:"notify_before"` CreatedAt time.Time `gorm:"column:created_at" json:"created_at" json:"created_at"` UpdatedAt time.Time `gorm:"column:updated_at" json:"updated_at" json:"updated_at"` }
Message is for creating Announcements, Alerts and other messages for the end users
type NullBool ¶ added in v0.79.4
NullBool is an alias for sql.NullBool data type
func NewNullBool ¶ added in v0.79.4
NewNullBool returns a sql.NullBool for JSON parsing
func (*NullBool) MarshalJSON ¶ added in v0.79.4
MarshalJSON for NullBool
func (*NullBool) UnmarshalJSON ¶ added in v0.79.4
Unmarshaler for NullBool
type NullFloat64 ¶ added in v0.79.4
type NullFloat64 struct {
sql.NullFloat64
}
NullFloat64 is an alias for sql.NullFloat64 data type
func NewNullFloat64 ¶ added in v0.79.4
func NewNullFloat64(s float64) NullFloat64
NewNullFloat64 returns a sql.NullFloat64 for JSON parsing
func (*NullFloat64) MarshalJSON ¶ added in v0.79.4
func (ni *NullFloat64) MarshalJSON() ([]byte, error)
MarshalJSON for NullFloat64
func (*NullFloat64) UnmarshalJSON ¶ added in v0.79.4
func (nf *NullFloat64) UnmarshalJSON(b []byte) error
Unmarshaler for NullFloat64
type NullInt64 ¶ added in v0.79.4
NullInt64 is an alias for sql.NullInt64 data type
func NewNullInt64 ¶ added in v0.79.4
NewNullInt64 returns a sql.NullInt64 for JSON parsing
func (*NullInt64) MarshalJSON ¶ added in v0.79.4
MarshalJSON for NullInt64
func (*NullInt64) UnmarshalJSON ¶ added in v0.79.4
Unmarshaler for NullInt64
type NullString ¶ added in v0.79.4
type NullString struct {
sql.NullString
}
NullString is an alias for sql.NullString data type
func NewNullString ¶ added in v0.79.4
func NewNullString(s string) NullString
NewNullString returns a sql.NullString for JSON parsing
func (*NullString) MarshalJSON ¶ added in v0.79.4
func (ns *NullString) MarshalJSON() ([]byte, error)
MarshalJSON for NullString
func (*NullString) UnmarshalJSON ¶ added in v0.79.4
func (nf *NullString) UnmarshalJSON(b []byte) error
Unmarshaler for NullString
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 NullString `gorm:"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 NullString `gorm:"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"` AllowNotifications NullBool `gorm:"default:false;column:allow_notifications" json:"allow_notifications"` 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 NullBool `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