Documentation ¶
Index ¶
- func InitDB(tomlConfig *TomlConfig) (db *sql.DB)
- func SyncTaskToDB(task *Task, tomlConfig *TomlConfig) (err error)
- func SyncWebsitesToDB(tomlConfig *TomlConfig) (err error)
- type DayStatus
- type MysqlConfig
- type NotificationConfig
- type PagerdutyConfig
- type Status
- type Task
- type TomlConfig
- type Website
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func SyncTaskToDB ¶
func SyncTaskToDB(task *Task, tomlConfig *TomlConfig) (err error)
SyncTaskToDB : store task to DB
func SyncWebsitesToDB ¶
func SyncWebsitesToDB(tomlConfig *TomlConfig) (err error)
SyncWebsitesToDB : sync websites of config.toml to db
Types ¶
type DayStatus ¶
type DayStatus struct { Date string `json:"date"` Count int `json:"count"` ErrCount int `json:"err_count"` ErrRate float32 `json:"err_rate"` }
DayStatus : status data of day
type NotificationConfig ¶
type NotificationConfig struct { ShouldNotifyErrorNum int `toml:"should_notify_error_num"` Pagerduty PagerdutyConfig }
NotificationConfig struct
type PagerdutyConfig ¶
type PagerdutyConfig struct { AuthToken string `toml:"auth_token"` ServiceID string `toml:"service_id"` From string `toml:"from"` NotificationTitle string `toml:"notification_title"` }
PagerdutyConfig struct
type Status ¶
type Status struct { ID int `json:"id"` TaskID int `json:"task_id"` WebsiteID int `json:"website_id"` Position string `json:"position"` URL string `json:"url"` Label string `json:"label"` Timestamp time.Time `json:"timestamp"` Filename string `json:"filename"` Elapsed string `json:"elapsed"` Method string `json:"method"` ResponseCode string `json:"response_code"` ResponseMessage string `json:"response_message"` Success string `json:"success"` FailureMessage string `json:"failure_message"` }
Status : Api status
func (Status) SaveToDB ¶
func (status Status) SaveToDB(tomlConfig *TomlConfig) (err error)
SaveToDB : save status data to db
type Task ¶
type Task struct { ID int `json:"id"` WebsiteID int `json:"website_id"` ExecutedAt time.Time `json:"executed_at"` Count int `json:"count"` ErrCount int `json:"err_count"` ErrRate float32 `json:"err_rate"` File string `json:"file"` }
Task : Task struct
type TomlConfig ¶
type TomlConfig struct { Title string Mysql MysqlConfig Notification NotificationConfig Websites []Website Datapath string Rows int }
TomlConfig struct
func InitConfig ¶
func InitConfig() (tomlConfig *TomlConfig, err error)
InitConfig : initialze config
Click to show internal directories.
Click to hide internal directories.