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 Callable
- 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 Cronable
- 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 PublicFunc
- type PublicFuncList
- type Registry
- type RegistryCollection
- type RegistryInterface
- type RegistryModule
- type RegistryModuleInterface
- 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 Callable ¶ added in v0.5.0
type Callable interface {
GetPublicFuncs() PublicFuncList
}
Callable interface for modules that are with GetPublicFuncs posibility to add custom public functions
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 Cronable ¶ added in v0.5.0
type Cronable interface {
Crons() CronList
}
Cronable interface for modules that are with func Crons return cronlist to add custom crons from modules to global list
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(eventName string, f EventFunc, call string, name 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" json:",omitempty"` DatabaseCreatedAt DatabaseUpdatedAt DatabaseDeletedAt Name string `json:",omitempty"` Version string `json:",omitempty"` }
ModuleVersion struct - structure of moduleVersion in database
type ModuleXML ¶ added in v0.4.0
ModuleXML 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 PublicFunc ¶ added in v0.5.0
type PublicFunc func(data ...interface{}) (interface{}, error)
PublicFunc function type for public function
type PublicFuncList ¶ added in v0.5.0
type PublicFuncList map[string]PublicFunc
PublicFuncList is a list of function
func (PublicFuncList) Call ¶ added in v0.5.0
func (pfl PublicFuncList) Call(name string, data ...interface{}) (i interface{}, err error)
Call function to call the public function of module
type Registry ¶ added in v0.3.0
type Registry struct {
// contains filtered or unexported fields
}
Registry struct - collection for registry
func (*Registry) Get ¶ added in v0.3.0
func (r *Registry) Get(name string) RegistryModuleInterface
Get module from registry by name
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
type RegistryCollection map[string]RegistryModule
RegistryCollection map of all modules in registry
type RegistryInterface ¶ added in v0.3.0
type RegistryInterface interface { Get(name string) RegistryModuleInterface 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 RegistryModule ¶ added in v0.5.0
type RegistryModule struct {
Module Module
}
RegistryModule structure
func (RegistryModule) GetCallable ¶ added in v0.5.0
func (rm RegistryModule) GetCallable() Callable
GetCallable will return nil or callable interface
func (RegistryModule) GetCronable ¶ added in v0.5.0
func (rm RegistryModule) GetCronable() Cronable
GetCronable will return nil or cronable interface
type RegistryModuleInterface ¶ added in v0.5.0
RegistryModuleInterface interface for registryModule
type Response ¶ added in v0.3.0
type Response struct { Status bool `json:"status"` Message string `json:"message"` Data DataResponse `json:"data"` StatusCode int `json:"statusCode"` }
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