From 86834c5a152e3ed388d2bab1b3cc0c47cc8345f4 Mon Sep 17 00:00:00 2001 From: John Date: Wed, 27 Feb 2019 22:17:09 +0800 Subject: [PATCH] version and comment updates --- g/g_func.go | 11 ++++++++++- g/g_logger.go | 6 ++++++ g/g_object.go | 18 +++++++++++++++++- version.go | 2 +- 4 files changed, 34 insertions(+), 3 deletions(-) diff --git a/g/g_func.go b/g/g_func.go index 3b2a2b3f4..286c19ca5 100644 --- a/g/g_func.go +++ b/g/g_func.go @@ -23,27 +23,36 @@ const ( LOG_LEVEL_CRIT = glog.LEVEL_CRIT ) +// NewVar creates a *Var. +// // 动态变量 func NewVar(i interface{}, unsafe...bool) *Var { return gvar.New(i, unsafe...) } +// Wait blocks until all the web servers shutdown. +// // 阻塞等待HTTPServer执行完成(同一进程多HTTPServer情况下) func Wait() { ghttp.Wait() } +// Dump dumps a variable to stdout with more manually readable. +// // 打印变量 func Dump(i...interface{}) { gutil.Dump(i...) } +// Throw throws a exception, which can be caught by Catch function. +// It always be used in TryCatch function. +// // 抛出一个异常 func Throw(exception interface{}) { gutil.Throw(exception) } -// try...catch... +// TryCatch does the try...catch... logic. func TryCatch(try func(), catch ... func(exception interface{})) { gutil.TryCatch(try, catch...) } \ No newline at end of file diff --git a/g/g_logger.go b/g/g_logger.go index b007ce785..551bade79 100644 --- a/g/g_logger.go +++ b/g/g_logger.go @@ -10,16 +10,22 @@ import ( "github.com/gogf/gf/g/os/glog" ) +// Disable/Enabled debug of logging globally. +// // 是否显示调试信息 func SetDebug(debug bool) { glog.SetDebug(debug) } +// Set the logging level globally. +// // 设置日志的显示等级 func SetLogLevel(level int) { glog.SetLevel(level) } +// Get the global logging level. +// // 获取设置的日志显示等级 func GetLogLevel() int { return glog.GetLevel() diff --git a/g/g_object.go b/g/g_object.go index 5aa0ea996..f8799b02d 100644 --- a/g/g_object.go +++ b/g/g_object.go @@ -17,42 +17,58 @@ import ( "github.com/gogf/gf/g/os/gcfg" ) +// Get an instance of http server with specified name. +// // HTTPServer单例对象 func Server(name...interface{}) *ghttp.Server { return ghttp.GetServer(name...) } +// Get an instance of tcp server with specified name. +// // TCPServer单例对象 func TCPServer(name...interface{}) *gtcp.Server { return gtcp.GetServer(name...) } +// Get an instance of udp server with specified name. +// // UDPServer单例对象 func UDPServer(name...interface{}) *gudp.Server { return gudp.GetServer(name...) } +// Get an instance of template engine object with specified name. +// // 核心对象:View func View(name...string) *gview.View { return gins.View(name...) } -// Config配置管理对象 +// Get an instance of config object with specified default config file name. +// +// Config配置管理对象, // 配置文件目录查找依次为:启动参数cfgpath、当前程序运行目录 func Config(file...string) *gcfg.Config { return gins.Config(file...) } +// Get an instance of database ORM object with specified configuration group name. +// // 数据库操作对象,使用了连接池 func Database(name...string) gdb.DB { return gins.Database(name...) } +// Alias of Database. +// // (别名)Database func DB(name...string) gdb.DB { return gins.Database(name...) } +// Get an instance of redis client with specified configuration group name. +// // Redis操作对象,使用了连接池 func Redis(name...string) *gredis.Redis { return gins.Redis(name...) diff --git a/version.go b/version.go index 9ec85e4a1..b8e9107d9 100644 --- a/version.go +++ b/version.go @@ -1,5 +1,5 @@ package gf -const VERSION = "v1.5.7" +const VERSION = "v1.5.8" const AUTHORS = "john"