Documentation ¶
Index ¶
- func LoadCfg(filePath string, templateData, dest interface{}) error
- func LoadTemplates(dirPath string, templateFunctions map[string]interface{}) (*texttemplate.Template, *htmltemplate.Template, error)
- func RenderCfg(filePath string, templateContent []byte, templateData interface{}) ([]byte, error)
- func Run(name, description string, implementation ServiceImplementation)
- func RunTest(name string, implementation ServiceImplementation, cfgPath string, ...)
- func YAMLValueToJSONValue(yamlValue interface{}) (interface{}, error)
- type Service
- func (s *Service) AddTemplateFunctions(functions map[string]interface{})
- func (s *Service) ErrorChan() chan<- error
- func (s *Service) HTTPClient(name string) *shttp.Client
- func (s *Service) HTTPServer(name string) *shttp.Server
- func (s *Service) PgClient(name string) *pg.Client
- func (s *Service) RenderHTMLTemplate(name string, data interface{}) ([]byte, error)
- func (s *Service) RenderTextTemplate(name string, data interface{}) ([]byte, error)
- func (s *Service) Stop()
- func (s *Service) Worker(name string) *Worker
- type ServiceAPI
- type ServiceAPICfg
- type ServiceCfg
- type ServiceImplementation
- type ServiceImplementationWithInitProgram
- type Worker
- type WorkerCfg
- type WorkerFunc
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func LoadTemplates ¶
func LoadTemplates(dirPath string, templateFunctions map[string]interface{}) (*texttemplate.Template, *htmltemplate.Template, error)
func Run ¶
func Run(name, description string, implementation ServiceImplementation)
func RunTest ¶
func RunTest(name string, implementation ServiceImplementation, cfgPath string, readyChan chan<- struct{})
func YAMLValueToJSONValue ¶
func YAMLValueToJSONValue(yamlValue interface{}) (interface{}, error)
Types ¶
type Service ¶
type Service struct { Cfg *ServiceCfg Log *log.Logger Name string Implementation ServiceImplementation Program *program.Program Hostname string Influx *influx.Client PgClients map[string]*pg.Client HTTPClients map[string]*shttp.Client HTTPServers map[string]*shttp.Server ServiceAPI *ServiceAPI Workers map[string]*Worker TextTemplate *texttemplate.Template HTMLTemplate *htmltemplate.Template // contains filtered or unexported fields }
func (*Service) AddTemplateFunctions ¶
func (*Service) RenderHTMLTemplate ¶
func (*Service) RenderTextTemplate ¶
type ServiceAPI ¶
type ServiceAPI struct { Cfg ServiceAPICfg Service *Service Log *log.Logger HTTPServer *shttp.Server }
func NewServiceAPI ¶
func NewServiceAPI(cfg ServiceAPICfg) *ServiceAPI
func (*ServiceAPI) Start ¶
func (s *ServiceAPI) Start() error
func (*ServiceAPI) Stop ¶
func (s *ServiceAPI) Stop()
type ServiceAPICfg ¶
type ServiceAPICfg struct { Log *log.Logger `json:"-"` Service *Service `json:"-"` HTTPServer string `json:"http_server"` }
func (*ServiceAPICfg) ValidateJSON ¶
func (cfg *ServiceAPICfg) ValidateJSON(v *ejson.Validator)
type ServiceCfg ¶
type ServiceCfg struct { Logger *log.LoggerCfg `json:"logger"` DataDirectory string `json:"data_directory"` Influx *influx.ClientCfg `json:"influx"` PgClients map[string]*pg.ClientCfg `json:"pg_clients"` HTTPClients map[string]*shttp.ClientCfg `json:"http_clients"` HTTPServers map[string]*shttp.ServerCfg `json:"http_servers"` ServiceAPI *ServiceAPICfg `json:"service_api"` Workers map[string]*WorkerCfg `json:"workers"` TemplateFuncMap map[string]interface{} `json:"-"` // contains filtered or unexported fields }
func (*ServiceCfg) ValidateJSON ¶
func (cfg *ServiceCfg) ValidateJSON(v *ejson.Validator)
type ServiceImplementation ¶
type ServiceImplementationWithInitProgram ¶
type ServiceImplementationWithInitProgram interface { ServiceImplementation InitProgram(*program.Program) }
type Worker ¶
type Worker struct { Cfg WorkerCfg Log *log.Logger // contains filtered or unexported fields }
type WorkerCfg ¶
type WorkerCfg struct { Log *log.Logger `json:"-"` WorkerFunc WorkerFunc `json:"-"` Disabled bool `json:"disabled"` InitialDelay int `json:"initial_delay"` // seconds }
Click to show internal directories.
Click to hide internal directories.