gins

package
v2.0.0-...-cbac34e Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 10, 2019 License: MIT Imports: 13 Imported by: 0

Documentation

Overview

Package gins provides instances management and core components management.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Config

func Config(name ...string) *gcfg.Config

Config returns an instance of View with default settings. The parameter <name> is the name for the instance.

func Database

func Database(name ...string) gdb.DB

Database returns an instance of database ORM object with specified configuration group name.

func Get

func Get(key string) interface{}

获取单例对象

func GetOrSet

func GetOrSet(key string, value interface{}) interface{}

当键名存在时返回其键值,否则写入指定的键值

func GetOrSetFunc

func GetOrSetFunc(key string, f func() interface{}) interface{}

当键名存在时返回其键值,否则写入指定的键值,键值由指定的函数生成

func GetOrSetFuncLock

func GetOrSetFuncLock(key string, f func() interface{}) interface{}

与GetOrSetFunc不同的是,f是在写锁机制内执行

func I18n

func I18n(name ...string) *gi18n.Manager

I18n returns an instance of gi18n.Manager. The parameter <name> is the name for the instance.

func Redis

func Redis(name ...string) *gredis.Redis

Redis returns an instance of redis client with specified configuration group name.

func Resource

func Resource(name ...string) *gres.Resource

Resource returns an instance of Resource. The parameter <name> is the name for the instance.

func Set

func Set(key string, value interface{})

设置单例对象

func SetIfNotExist

func SetIfNotExist(key string, value interface{}) bool

当键名不存在时写入,并返回true;否则返回false。

func View

func View(name ...string) *gview.View

View returns an instance of View with default settings. The parameter <name> is the name for the instance.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL