对象管理
全局对象
gf框架封装了一些常用的数据类型以及对象,可以直接通过g.*方便获取。
使用方式:
import "gitee.com/johng/gf/g"
数据类型
// 常用map数据结构
type Map map[string]interface{}
// 常用list数据结构
type List []Map
常用对象
- (单例)配置管理对象 ``` // 参数file未非必需参数,表示指定获取的配置文件管理对象 func Config(file...string) *gcfg.Config
2. **(单例)模板引擎对象** ```
func View() *gview.View
- (单例)Http Server ``` func Server(name...interface{}) *ghttp.Server
4. **(单例)TCP Server** ```
func TcpServer(name...interface{}) *gtcp.Server
- (单例)Udp Server ``` func UdpServer(name...interface{}) *gudp.Server
6. **(单例)数据库ORM对象** ```
func Database(name...string) *gdb.Db
// 别名
func DB(name...string) *gdb.Db
- (单例)Redis客户端对象
func Redis(name...string) *gredis.Redis
