Documentation
¶
Index ¶
- func GetCache() *bigcache.BigCache
- func GetRouter() *mux.Router
- func InitVersion()
- func LoadModules(dirs []string)
- func RegisterRoutes(corsOpts *cors.Cors)
- func SendJSONResponse(w http.ResponseWriter, r Response)
- func Start(conf ConfigInterface)
- func StartCrons(cronList []Cron)
- type Cmd
- type Config
- func (c *Config) AddCron(spec Spec, cmd Cmd)
- func (c *Config) AddModuleDirs(dir ...string)
- func (c *Config) GetCorsOpts() *cors.Cors
- func (c *Config) GetCrons() CronList
- func (c *Config) GetModuleDirs() []string
- func (c *Config) GetServerConf() *http.Server
- func (c *Config) SetCorsOpts(cors *cors.Cors)
- func (c *Config) SetServerConfig(s *http.Server)
- type ConfigInterface
- type Cron
- type CronList
- type DataResponse
- type Database
- type DatabaseCreatedAt
- type DatabaseDeletedAt
- type DatabaseID
- type DatabaseUpdatedAt
- type Event
- type EventCollection
- type EventFunc
- type Eventable
- type Events
- type EventsInterface
- type Fire
- type Installable
- type ModelBase
- type Module
- type ModuleVersion
- type ModuleXML
- type Registry
- type RegistryCollection
- type RegistryInterface
- type Response
- type Routable
- type Routes
- type Spec
- type Upgradable
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func InitVersion ¶ added in v0.3.0
func InitVersion()
InitVersion - initialize version with automigration
func LoadModules ¶ added in v0.3.0
func LoadModules(dirs []string)
LoadModules will load all modules inside modules directory
func RegisterRoutes ¶ added in v0.3.0
RegisterRoutes - listen for routes
func SendJSONResponse ¶ added in v0.3.0
func SendJSONResponse(w http.ResponseWriter, r Response)
SendJSONResponse will set type to application/json and send to response
func Start ¶
func Start(conf ConfigInterface)
Start eather application initialize http server and load all modules
func StartCrons ¶ added in v0.3.0
func StartCrons(cronList []Cron)
StartCrons will start crons in background
Types ¶
type Config ¶ added in v0.3.0
type Config struct {
// contains filtered or unexported fields
}
Config structure of config for Eather
func (*Config) AddModuleDirs ¶ added in v0.3.2
AddModuleDirs will replace moduleDirs by new
func (*Config) GetCorsOpts ¶ added in v0.4.0
GetCorsOpts returns cor config
func (*Config) GetModuleDirs ¶ added in v0.3.2
GetModuleDirs returns directories of modules
func (*Config) GetServerConf ¶ added in v0.4.0
GetServerConf returns server configuration
func (*Config) SetCorsOpts ¶ added in v0.4.0
SetCorsOpts will set cors for application
func (*Config) SetServerConfig ¶ added in v0.4.0
SetServerConfig will set server configuration
type ConfigInterface ¶ added in v0.4.0
type ConfigInterface interface {
AddCron(spec Spec, cmd Cmd)
AddModuleDirs(dir ...string)
SetCorsOpts(cors *cors.Cors)
SetServerConfig(*http.Server)
GetCrons() CronList
GetModuleDirs() []string
GetCorsOpts() *cors.Cors
GetServerConf() *http.Server
}
ConfigInterface interface of config
func GetConfig ¶ added in v0.3.2
func GetConfig() ConfigInterface
GetConfig will return default config settings
type DataResponse ¶ added in v0.3.1
type DataResponse map[string]interface{}
DataResponse set DataResponse type
type DatabaseCreatedAt ¶ added in v0.4.0
DatabaseCreatedAt set default created_at column
type DatabaseDeletedAt ¶ added in v0.4.0
DatabaseDeletedAt set default deleted_at column
type DatabaseID ¶ added in v0.4.0
DatabaseID set default ID column
func (*DatabaseID) BeforeCreate ¶ added in v0.4.0
func (base *DatabaseID) BeforeCreate(scope *gorm.Scope) error
BeforeCreate will set a UUID rather than numeric ID.
type DatabaseUpdatedAt ¶ added in v0.4.0
DatabaseUpdatedAt set default updated_at column
type EventCollection ¶ added in v0.3.0
EventCollection is definition of events collection
type EventFunc ¶ added in v0.4.0
type EventFunc func(data ...interface{})
EventFunc type of events func
type Eventable ¶ added in v0.4.0
type Eventable interface {
GetEventFuncs() []Fire
}
Eventable interface for modules that are with events add this func to module to enable events
type Events ¶ added in v0.3.0
type Events struct {
Collection EventCollection
}
Events struct - collection of events
func (*Events) Emmit ¶ added in v0.3.0
Emmit the event from the collection data will be passed to the event func
func (*Events) GetCollection ¶ added in v0.3.0
func (r *Events) GetCollection() EventCollection
GetCollection will return collection of events
type EventsInterface ¶ added in v0.3.0
type EventsInterface interface {
Emmit(name string, data ...interface{})
Add(name string, f EventFunc, call string)
Remove(name string)
GetCollection() EventCollection
}
EventsInterface interface of events
func GetEvents ¶ added in v0.3.0
func GetEvents() EventsInterface
GetEvents - get collection of all registered events
type Installable ¶ added in v0.4.0
type Installable interface {
Install()
}
Installable interface for modules that are with func Install add this func to run install func during installation of module
type ModelBase ¶ added in v0.4.0
type ModelBase struct {
DatabaseID
DatabaseCreatedAt
DatabaseUpdatedAt
DatabaseDeletedAt
}
ModelBase contains common columns for all tables.
type ModuleVersion ¶ added in v0.3.0
type ModuleVersion struct {
ID uint `gorm:"primary_key"`
DatabaseCreatedAt
DatabaseUpdatedAt
DatabaseDeletedAt
Name string
Version string
}
ModuleVersion struct - structure of moduleVersion in database
type ModuleXML ¶ added in v0.4.0
Module of type ModuleXML
func (ModuleXML) GetVersion ¶ added in v0.4.0
GetVersion - load version from database
func (ModuleXML) UpdateVersion ¶ added in v0.4.0
func (m ModuleXML) UpdateVersion()
UpdateVersion - set the new version of the module to the database
type Registry ¶ added in v0.3.0
type Registry struct {
// contains filtered or unexported fields
}
Registry struct - collection for registry
func (*Registry) GetCollection ¶ added in v0.4.0
func (r *Registry) GetCollection() RegistryCollection
GetCollection returns collection of all modules
type RegistryCollection ¶ added in v0.4.0
RegistryCollection map of all modules in registry
type RegistryInterface ¶ added in v0.3.0
type RegistryInterface interface {
Get(name string) Module
GetCollection() RegistryCollection
Add(object Module, name string)
Contains(name string) bool
Remove(name string)
}
RegistryInterface - interface for a registry
func GetRegistry ¶ added in v0.3.0
func GetRegistry() RegistryInterface
GetRegistry load registry collection
type Response ¶ added in v0.3.0
type Response struct {
Status bool
Message string
Data DataResponse
StatusCode int
}
Response struct - customize response for routes
type Routable ¶ added in v0.4.0
type Routable interface {
MapRoutes()
}
Routable interface for modules that are with func Routable add this func to map routes for module
type Upgradable ¶ added in v0.4.0
type Upgradable interface {
Upgrade(version string)
}
Upgradable interface for modules that are with func Upgrade add this func to run Upgrade after upgrading module version