Documentation ¶
Overview ¶
Package gins provides instances management and some core components.
单例对象管理. 框架内置了一些核心对象获取方法,并且可以通过Set和Get方法实现IoC以及对内置核心对象的自定义替换
Index ¶
- func Config(file ...string) *gcfg.Config
- func Database(name ...string) gdb.DB
- func Get(key string) interface{}
- func GetOrSet(key string, value interface{}) interface{}
- func GetOrSetFunc(key string, f func() interface{}) interface{}
- func GetOrSetFuncLock(key string, f func() interface{}) interface{}
- func Redis(name ...string) *gredis.Redis
- func Set(key string, value interface{})
- func SetIfNotExist(key string, value interface{}) bool
- func View(name ...string) *gview.View
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetOrSetFunc ¶
func GetOrSetFunc(key string, f func() interface{}) interface{}
当键名存在时返回其键值,否则写入指定的键值,键值由指定的函数生成
func GetOrSetFuncLock ¶
func GetOrSetFuncLock(key string, f func() interface{}) interface{}
与GetOrSetFunc不同的是,f是在写锁机制内执行
func SetIfNotExist ¶
当键名不存在时写入,并返回true;否则返回false。
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.