Documentation
¶
Index ¶
- Constants
- func Bod(t time.Time) time.Time
- func Bom(t time.Time) time.Time
- func Boy(t time.Time) time.Time
- func DiffToMonth(t time.Time, m time.Month) int
- func DiffToWeekday(t time.Time, wd time.Weekday) int
- func HTTPHandlerDeleteJob(r *Runner) func(c *gin.Context)
- func HTTPHandlerHealthCheck() func(c *gin.Context)
- func HTTPHandlerJobDetail(r *Runner) func(c *gin.Context)
- func HTTPHandlerListJobs(r *Runner) func(c *gin.Context)
- func HTTPHandlerPing() func(c *gin.Context)
- func HTTPHandlerRegisterJob(r *Runner) func(c *gin.Context)
- func HTTPHandlerVersion() func(c *gin.Context)
- func JobArgs(a []interface{}) (string, []string, time.Time)
- type Callback
- type Event
- type JSONMessage
- type Job
- type JobScheduledMessage
- type MQTTClient
- type Pattern
- type PublishHandler
- type RedisClient
- type Runner
- func (r *Runner) AddHandler(name string, f Callback)
- func (r *Runner) AddJob(job Job) ([]time.Time, error)
- func (r *Runner) AddJobs(jobs []Job)
- func (r *Runner) Emit(name string, args ...interface{})
- func (r *Runner) GetJob(name string) *Job
- func (r *Runner) HasJob(job *Job) bool
- func (r *Runner) RemoveJob(job *Job)
- func (r *Runner) Schedule(j Job, n time.Time, index int)
- func (r *Runner) Subscribe(name string, f Callback)
- func (r *Runner) Sync(s Sync)
- func (r *Runner) ToJSON() ([]*Job, error)
- type Server
- type Sync
- type SyncRedis
Constants ¶
View Source
const ( MalformedMessage string = "Malformed or empty request body" InvalidJobRequestBody string = "\"pattern\" and \"name\" must be present" UnableToSerializeJobs string = "Unable to serialize jobs" )
View Source
const HORLOGE_KEY = "horloge_jobs"
View Source
const (
JobExistsError string = "Cannot add task \"%s\", another task with the same name exists"
)
View Source
const MQTT_CHANNEL = "horloge/job"
View Source
const PUBSUB_CHANNEL = "horloge"
View Source
const (
Version string = "0.1.0"
)
Variables ¶
This section is empty.
Functions ¶
func HTTPHandlerDeleteJob ¶
HTTPHandlerDeleteJob Delete a job
func HTTPHandlerHealthCheck ¶
HTTPHandlerHealthCheck Handles GET requests to /health_check.
Replies an empty string and status code 200. This is useful if you want to monitor the state of the application.
func HTTPHandlerJobDetail ¶
HTTPHandlerJobDetail Show job detail
func HTTPHandlerListJobs ¶
HTTPHandlerListJobs List Jobs
func HTTPHandlerRegisterJob ¶
HTTPHandlerRegisterJob Handles POST requests to /jobs.
To add a job you must send a request to /jobs with a json body
func HTTPHandlerVersion ¶
HTTPHandlerVersion Handles GET requests to /version.
Replies with project version
Types ¶
type JSONMessage ¶
type Job ¶
type JobScheduledMessage ¶
type MQTTClient ¶
type MQTTClient struct {
// contains filtered or unexported fields
}
func NewMQTTClient ¶
func NewMQTTClient(addr string) *MQTTClient
func (*MQTTClient) Publish ¶
func (c *MQTTClient) Publish(channel string, payload string)
type Pattern ¶
type Pattern struct { Second int `json:"second" form:"second" query:"second"` Minute int `json:"minute" form:"minute" query:"minute"` Hour int `json:"hour" form:"hour" query:"hour"` Day int `json:"day" form:"day" query:"day"` Month int `json:"month" form:"month" query:"month"` Year int `json:"year" form:"year" query:"year"` Occurence string `json:"occurence" form:"occurence" query:"occurence"` Days []time.Weekday Months []time.Month Now time.Time }
func NewPattern ¶
type PublishHandler ¶
type RedisClient ¶
type RedisClient struct {
// contains filtered or unexported fields
}
func NewRedisClient ¶
func NewRedisClient(addr string, passwd string, db int) *RedisClient
func (*RedisClient) AddPublishHandler ¶
func (c *RedisClient) AddPublishHandler(handler PublishHandler)
func (*RedisClient) Wait ¶
func (c *RedisClient) Wait()
type Runner ¶
type Runner struct {
// contains filtered or unexported fields
}
func (*Runner) AddHandler ¶
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
func NewWebsocketServer ¶
func NewWebsocketServer() *Server
Source Files
¶
Click to show internal directories.
Click to hide internal directories.