Documentation ¶
Index ¶
- func Cors() gin.HandlerFunc
- func GetCurrentDirectory(dir string) (string, error)
- func LoadCfg(dir string, inter interface{})
- func LoadEnvCfg(dir, env string, inter interface{})
- func LoadEnvFileName(dir, env string) string
- func LoadFileName(dir string) string
- type BasePlugin
- func (d *BasePlugin) Close()
- func (d *BasePlugin) DefaultMgo() *mgo.Database
- func (d *BasePlugin) DefaultMysql() *gorm.DB
- func (d *BasePlugin) DefaultPost() *gorm.DB
- func (d *BasePlugin) DefaultRedis() *redis.Client
- func (d BasePlugin) DefaultRest() *rest.RestTemplate
- func (d *BasePlugin) Health() error
- func (d *BasePlugin) InterfaceName() string
- func (d *BasePlugin) Mgo(name string) *mgo.Database
- func (d *BasePlugin) Mysql(name string) *gorm.DB
- func (d *BasePlugin) Open(injector *inject.Injector) error
- func (d *BasePlugin) Post(name string) *gorm.DB
- func (d *BasePlugin) Redis(name string) *redis.Client
- func (d *BasePlugin) Rest(name string) *rest.RestTemplate
- type Boot
- func (b *Boot) AddApply(pointers ...interface{}) *Boot
- func (b *Boot) AddApplyCfg(pointers ...interface{}) *Boot
- func (b *Boot) AddAsyncFun(fun func(injector *inject.Injector)) *Boot
- func (b *Boot) AddFun(fun func(injector *inject.Injector)) *Boot
- func (b *Boot) AddPlugins(plugins ...Plugin)
- func (b *Boot) AddTask(name, cron string, fun func()) *Boot
- func (b *Boot) BindHttp(r ...func(router *gin.RouterGroup, injector *inject.Injector))
- func (b *Boot) Close()
- func (b *Boot) GetInject() *inject.Injector
- func (b *Boot) Start(dir, env string) *Boot
- func (b *Boot) StartAndDir(dir string) *Boot
- type Cmd
- type Config
- type ConfigStruct
- type Cron
- type IService
- type Info
- type Jewel
- type JewelProperties
- type Log
- type Manager
- type MgoDataSource
- type Plugin
- type Profiles
- type Properties
- type RedisDataSource
- type RestProperties
- type ServerProperties
- type SqlDataSource
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetCurrentDirectory ¶
func LoadEnvCfg ¶
func LoadEnvCfg(dir, env string, inter interface{})
func LoadEnvFileName ¶
func LoadFileName ¶
Types ¶
type BasePlugin ¶
type BasePlugin struct { MysqlDb map[string]*gorm.DB PostDb map[string]*gorm.DB RedisDb map[string]*redis.Client MgoDb map[string]*mgo.Database RestTemplate map[string]*rest.RestTemplate }
func NewBasePlugin ¶
func NewBasePlugin() *BasePlugin
func (*BasePlugin) Close ¶
func (d *BasePlugin) Close()
func (*BasePlugin) DefaultMgo ¶
func (d *BasePlugin) DefaultMgo() *mgo.Database
func (*BasePlugin) DefaultMysql ¶
func (d *BasePlugin) DefaultMysql() *gorm.DB
func (*BasePlugin) DefaultPost ¶
func (d *BasePlugin) DefaultPost() *gorm.DB
func (*BasePlugin) DefaultRedis ¶
func (d *BasePlugin) DefaultRedis() *redis.Client
func (BasePlugin) DefaultRest ¶
func (d BasePlugin) DefaultRest() *rest.RestTemplate
func (*BasePlugin) Health ¶
func (d *BasePlugin) Health() error
func (*BasePlugin) InterfaceName ¶
func (d *BasePlugin) InterfaceName() string
func (*BasePlugin) Mgo ¶
func (d *BasePlugin) Mgo(name string) *mgo.Database
func (*BasePlugin) Rest ¶
func (d *BasePlugin) Rest(name string) *rest.RestTemplate
type Boot ¶
func NewInstance ¶
func NewInstance() *Boot
func (*Boot) AddApplyCfg ¶
func (*Boot) AddPlugins ¶
func (*Boot) BindHttp ¶
func (b *Boot) BindHttp(r ...func(router *gin.RouterGroup, injector *inject.Injector))
func (*Boot) StartAndDir ¶
type Config ¶
type Config struct { Jewel struct { Log string `json:"log" yaml:"log"` Max_Open_Conns int `json:"max-open-conns" yaml:"max-open-conns"` Max_Idle_Conns int `json:"max-idle-conns" yaml:"max-idle-conns" xml:"max-idle-conns"` SqlShow bool `json:"sql_show" yaml:"sql_show" xml:"sql_show"` Mysql string `json:"mysql" yaml:"mysql" xml:"mysql"` Mgo string `json:"mgo" yaml:"mgo" xml:"mgo"` MgoDb string `json:"mgo_db" yaml:"mgo_db" xml:"mgo_db"` Name string `json:"name" yaml:"name" xml:"name"` Port int `json:"port" yaml:"port" xml:"port"` Postgres string `json:"postgres" yaml:"postgres" xml:"postgres"` Amqp string `json:"amqp" yaml:"amqp" xml:"amqp"` Amqp_Max_Channel int `json:"amqp_max_channel" yaml:"amqp_max_channel" xml:"amqp_max_channel"` Amqp_Vhost string `json:"amqp_vhost" yaml:"amqp_vhost" xml:"amqp_vhost"` Profiles struct { Active string `json:"active"` } `json:"profiles" yaml:"profiles" xml:"profiles"` Redis struct { Db int `json:"db"` Host string `json:"host"` Password string `json:"password"` } `json:"redis" yaml:"redis" xml:"redis"` JsonRpc struct { Enabled *bool `json:"enabled"` UserName string `json:"username"` Password string `json:"password"` } `json:"jsonrpc" yaml:"jsonrpc" xml:"jsonrpc"` Sqlite3 string `json:"sqlite3" yaml:"sqlite3" xml:"sqlite3"` } `json:"jewel" yaml:"jewel" xml:"jewel"` }
type ConfigStruct ¶
type ConfigStruct struct { }
func (*ConfigStruct) Load ¶
func (config *ConfigStruct) Load(fileName string, inter interface{})
type Jewel ¶
type Jewel struct { Name string `json:"name" yaml:"name" xml:"name"` Log Log `json:"log" yaml:"log" xml:"log"` Server ServerProperties `json:"server" yaml:"server" xml:"server"` Profiles Profiles `json:"profiles" yaml:"profiles" xml:"profiles"` MySql map[string]SqlDataSource `json:"mysql" yaml:"mysql" xml:"mysql"` Postgres map[string]SqlDataSource `json:"postgres" yaml:"postgres" xml:"postgres"` Redis map[string]RedisDataSource `json:"redis" yaml:"redis" xml:"redis"` Mgo map[string]MgoDataSource `json:"mgo" yaml:"mgo" xml:"mgo"` Rest map[string]RestProperties `json:"rest" yaml:"rest" xml:"rest"` }
type JewelProperties ¶
type JewelProperties struct {
Jewel Jewel `json:"jewel" yaml:"jewel" xml:"jewel"`
}
type MgoDataSource ¶
type MgoDataSource struct { Address *string `json:"address" yaml:"address" xml:"address"` Database *string `json:"database" yaml:"database" xml:"database"` Direct *bool `json:"direct" yaml:"direct" xml:"direct"` FailFast *bool `json:"fail_fast" yaml:"fail_fast" xml:"fail_fast"` Password *string `json:"password" yaml:"password" xml:"password"` PoolLimit *int `json:"pool_limit" yaml:"pool_limit" xml:"pool_limit"` ReplicaSetName *string `json:"replica_set_name" yaml:"replica_set_name" xml:"replica_set_name"` Service *string `json:"service" yaml:"service" xml:"service"` ServiceHost *string `json:"service_host" yaml:"service_host" xml:"service_host"` Source *string `json:"source" yaml:"source" xml:"source"` Timeout *int `json:"timeout" yaml:"timeout" xml:"timeout"` UserName *string `json:"user_name" yaml:"user_name" xml:"user_name"` Enabled *bool `json:"enabled" yaml:"enabled" xml:"enabled"` }
func (*MgoDataSource) Create ¶
func (ds *MgoDataSource) Create() (*mgo.Database, error)
type Properties ¶
type Properties struct {
// contains filtered or unexported fields
}
func NewProperties ¶
func NewProperties() *Properties
func (*Properties) Load ¶
func (prop *Properties) Load(fileName string, inter interface{})
type RedisDataSource ¶
type RedisDataSource struct { Addr *string `json:"addr" yaml:"addr" xml:"addr"` Db *int `json:"db" yaml:"db" xml:"db"` DialTimeout *int `json:"dial_timeout" yaml:"dial_timeout" xml:"dial_timeout"` IdleCheckFrequency *int `json:"idle_check_frequency" yaml:"idle_check_frequency" xml:"idle_check_frequency"` IdleTimeout *int `json:"idle_timeout" yaml:"idle_timeout" xml:"idle_timeout"` MaxRetries *int `json:"max_retries" yaml:"max_retries" xml:"max_retries"` MaxRetryBackOff *int `json:"max_retry_back_off" yaml:"max_retry_back_off" xml:"max_retry_back_off"` MinRetryBackOff *int `json:"min_retry_back_off" yaml:"min_retry_back_off" xml:"min_retry_back_off"` Network *string `json:"network" yaml:"network" xml:"network"` Password *string `json:"password" yaml:"password" xml:"password"` PoolSize *int `json:"pool_size" yaml:"pool_size" xml:"pool_size"` PoolTimeout *int `json:"pool_timeout" yaml:"pool_timeout" xml:"pool_timeout"` ReadTimeout *int `json:"read_timeout" yaml:"read_timeout" xml:"read_timeout"` TLS *bool `json:"tls" yaml:"tls" xml:"tls"` WriteTimeout *int `json:"write_timeout" yaml:"write_timeout" xml:"write_timeout"` Enabled *bool `json:"enabled" yaml:"enabled" xml:"enabled"` }
type RestProperties ¶
type RestProperties struct { Authorization *string `json:"authorization" yaml:"authorization" xml:"authorization"` DisableCompression *bool `json:"disable_compression" yaml:"disable_compression" xml:"disable_compression"` IdleConnTimeout *int `json:"idle_conn_timeout" yaml:"idle_conn_timeout" xml:"idle_conn_timeout"` MaxIdleConns *int `json:"max_idle_conns" yaml:"max_idle_conns" xml:"max_idle_conns"` ReplyCount *int `json:"reply_count" yaml:"reply_count" xml:"reply_count"` SocketTimeout *int `json:"socket_timeout" yaml:"socket_timeout" xml:"socket_timeout"` Enabled *bool `json:"enabled" yaml:"enabled" xml:"enabled"` }
func (*RestProperties) Create ¶
func (restOptions *RestProperties) Create() (*rest.RestTemplate, error)
type ServerProperties ¶
type ServerProperties struct { GinMode *string `json:"gin_mode" yaml:"gin_mode" xml:"gin_mode"` EnablePprof *bool `json:"enable_pprof" yaml:"enable_pprof" xml:"enable_pprof"` ContextPath *string `json:"context_path" yaml:"context_path" xml:"context_path"` Port int64 `json:"port" yaml:"port" xml:"port"` Templates *string `json:"templates" yaml:"templates" xml:"templates"` EnableTls *bool `json:"enable_tls" yaml:"enable_tls" xml:"enable_tls"` X509KeyPairServerPem *string `json:"x509_key_pair_server_pem" yaml:"x509_key_pair_server_pem" xml:"x509_key_pair_server_pem"` X509KeyPairServerKey *string `json:"x509_key_pair_server_key" yaml:"x509_key_pair_server_key" xml:"x509_key_pair_server_key"` ReadTimeout *int64 `json:"read_timeout" yaml:"read_timeout" xml:"read_timeout"` ReadHeaderTimeout *int64 `json:"read_header_timeout" yaml:"read_header_timeout" xml:"read_header_timeout"` WriteTimeout *int64 `json:"write_timeout" yaml:"write_timeout" xml:"write_timeout"` IdleTimeout *int64 `json:"idle_timeout" yaml:"idle_timeout" xml:"idle_timeout"` MaxHeaderBytes *int `json:"max_header_bytes" yaml:"max_header_bytes" xml:"max_header_bytes"` Manager Manager `json:"manager" yaml:"manager" xml:"max_header_bytes"` }
type SqlDataSource ¶
type SqlDataSource struct { ConnMaxLifeTime *int `json:"conn_max_life_time" yaml:"conn_max_life_time" xml:"conn_max_life_time"` MaxIdleConns *int `json:"max_idle_conns" yaml:"max_idle_conns" xml:"max_idle_conns"` MaxOpenConns *int `json:"max_open_conns" yaml:"max_open_conns" xml:"max_open_conns"` SqlShow *bool `json:"sql_show" yaml:"show_sql" xml:"show_sql"` URL *string `json:"url" yaml:"url" xml:"url"` Enabled *bool `json:"enabled" yaml:"enabled" xml:"enabled"` }
Click to show internal directories.
Click to hide internal directories.