Documentation ¶
Overview ¶
Package gins provides instances and core components management.
Index ¶
- func Config(name ...string) *gcfg.Config
- func Database(name ...string) gdb.DB
- func Get(name string) interface{}
- func GetOrSet(name string, instance interface{}) interface{}
- func GetOrSetFunc(name string, f func() interface{}) interface{}
- func GetOrSetFuncLock(name string, f func() interface{}) interface{}
- func I18n(name ...string) *gi18n.Manager
- func Log(name ...string) *glog.Logger
- func Redis(name ...string) *gredis.Redis
- func Resource(name ...string) *gres.Resource
- func Server(name ...interface{}) *ghttp.Server
- func Set(name string, instance interface{})
- func SetIfNotExist(name string, instance interface{}) bool
- func View(name ...string) *gview.View
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Config ¶
Config returns an instance of View with default settings. The parameter <name> is the name for the instance.
func Database ¶
Database returns an instance of database ORM object with specified configuration group name.
func GetOrSet ¶
func GetOrSet(name string, instance interface{}) interface{}
GetOrSet returns the instance by name, or set instance to the instance manager if it does not exist and returns this instance.
func GetOrSetFunc ¶
func GetOrSetFunc(name string, f func() interface{}) interface{}
GetOrSetFunc returns the instance by name, or sets instance with returned value of callback function <f> if it does not exist and then returns this instance.
func GetOrSetFuncLock ¶
func GetOrSetFuncLock(name string, f func() interface{}) interface{}
GetOrSetFuncLock returns the instance by name, or sets instance with returned value of callback function <f> if it does not exist and then returns this instance.
GetOrSetFuncLock differs with GetOrSetFunc function is that it executes function <f> with mutex.Lock of the hash map.
func I18n ¶
I18n returns an instance of gi18n.Manager. The parameter <name> is the name for the instance.
func Log ¶ added in v1.10.0
Log returns an instance of glog.Logger. The parameter <name> is the name for the instance.
func Resource ¶
Resource returns an instance of Resource. The parameter <name> is the name for the instance.
func Set ¶
func Set(name string, instance interface{})
Set sets a instance object to the instance manager with given name.
func SetIfNotExist ¶
SetIfNotExist sets <instance> to the map if the <name> does not exist, then returns true. It returns false if <name> exists, and <instance> would be ignored.
Types ¶
This section is empty.