Documentation ¶
Overview ¶
利用 reflect 技术把结构体的可 export 值复制到 dst 中,dst 必须是相似结构体的指针。 copy the exported value of a struct to dst , with reflect.
Index ¶
- Variables
- func Any(relativePath string, handlers ...interface{}) gin.IRouter
- func CheckMobile(mobile string) bool
- func ComparePassword(password, passwordInDb string) bool
- func DELETE(relativePath string, handlers ...interface{}) gin.IRouter
- func Db(params ...interface{}) *gorm.DB
- func DefaultGroup(handlers ...interface{})
- func GET(relativePath string, handlers ...interface{}) gin.IRouter
- func GetCurrentPath() (string, error)
- func Gorm(params ...interface{}) *gorm.DB
- func Group(relativePath string, handlers ...interface{}) gin.IRouter
- func HEAD(relativePath string, handlers ...interface{}) gin.IRouter
- func Handle(httpMethod, relativePath string, handlers ...interface{}) gin.IRouter
- func JwtParseToken(token string, secret ...string) (map[string]interface{}, error)
- func JwtToken(data map[string]interface{}, secret ...string) (string, error)
- func OPTIONS(relativePath string, handlers ...interface{}) gin.IRouter
- func PATCH(relativePath string, handlers ...interface{}) gin.IRouter
- func POST(relativePath string, handlers ...interface{}) gin.IRouter
- func PUT(relativePath string, handlers ...interface{}) gin.IRouter
- func ParseMainDbDsn() string
- func Password(password string, authCode ...string) string
- func Run(addr ...string)
- func Struct2Map(src interface{}, dst map[string]interface{}) error
- func StructCopy(src, dst interface{}, ignoreFields ...string) error
- func StructFill(src, dst interface{}) error
- func Validate(data interface{}, scene ...string) (bool, string)
- func ValidateBatch(data interface{}, scene ...string) (bool, map[string]map[string]string)
- type Config
- func (t *Config) AllSettings() map[string]interface{}
- func (t *Config) Get(key string) interface{}
- func (t *Config) GetString(key string) string
- func (t *Config) IsSet(key string) bool
- func (t *Config) ReadConfig(name string) (bool, error)
- func (t *Config) ReadDataBaseConfig() map[string]string
- func (t *Config) Set(key string, value interface{})
- func (t *Config) SetDefault(key string, value interface{})
- type Context
- func (c *Context) DefaultParamInt(key string, defaultResult int) (result int)
- func (c *Context) DefaultParamInt64(key string, defaultResult int64) (result int64)
- func (c *Context) DefaultParamUint(key string, defaultResult uint) (result uint)
- func (c *Context) DefaultParamUint64(key string, defaultResult uint64) (result uint64)
- func (c *Context) DefaultQueryInt(key string, defaultResult int) (result int)
- func (c *Context) DefaultQueryInt64(key string, defaultResult int64) (result int64)
- func (c *Context) DefaultQueryUint(key string, defaultResult uint) (result uint)
- func (c *Context) DefaultQueryUint64(key string, defaultResult uint64) (result uint64)
- func (c *Context) Error(msg string, params ...interface{})
- func (c *Context) ParamInt(key string) (result int)
- func (c *Context) ParamInt64(key string) (result int64)
- func (c *Context) ParamUint(key string) (result uint)
- func (c *Context) ParamUint64(key string) (result uint64)
- func (c *Context) QueryInt(key string) (result int)
- func (c *Context) QueryInt64(key string) (result int64)
- func (c *Context) QueryPage(defaultPageSize ...int) (page, pageSize int)
- func (c *Context) QueryUint(key string) (result uint)
- func (c *Context) QueryUint64(key string) (result uint64)
- func (c *Context) Result(msg string, code int, params ...interface{})
- func (c *Context) SetUserId(userId string)
- func (c *Context) ShouldBindFailError(obj interface{}, msg ...string)
- func (c *Context) ShouldBindValidateFailError(obj interface{}, msg1scene2 ...string)
- func (c *Context) Success(msg string, params ...interface{})
- func (c *Context) UserId() string
- func (c *Context) ValidateFailError(data interface{}, scene ...string)
- type HandlerFunc
- type Model
Constants ¶
This section is empty.
Variables ¶
var ( IsEmail = govalidator.IsEmail IsExistingEmail = govalidator.IsExistingEmail IsAlpha = govalidator.IsAlpha IsAlphanumeric = govalidator.IsAlphanumeric IsBase64 = govalidator.IsBase64 IsFloat = govalidator.IsFloat IsIP = govalidator.IsIP )
var Dump = godump.Dump
var (
Router *gin.Engine
)
Functions ¶
func Any ¶
Any registers a route that matches all the HTTP methods. GET, POST, PUT, PATCH, HEAD, OPTIONS, DELETE, CONNECT, TRACE.
func CheckMobile ¶
func ComparePassword ¶
func GetCurrentPath ¶
func Group ¶
create new route group relativePath,examples: /users /users/:id handlers,examples:gin.HandlerFunc,catgo.HandlerFunc
func Handle ¶
Handle registers a new request handle and middleware with the given path and method. The last handler should be the real handler, the other ones should be middleware that can and should be shared among different routes. See the example code in GitHub.
For GET, POST, PUT, PATCH and DELETE requests the respective shortcut functions can be used.
This function is intended for bulk loading and to allow the usage of less frequently used, non-standardized or custom methods (e.g. for internal communication with a proxy).
func JwtParseToken ¶
func ParseMainDbDsn ¶
func ParseMainDbDsn() string
func Struct2Map ¶
func StructCopy ¶
StructCopy copy the exported value of a struct to a likely struct , with reflect.
func StructFill ¶
func StructFill(src, dst interface{}) error
Types ¶
type Config ¶
type Config struct { }
func (*Config) AllSettings ¶
func (*Config) ReadDataBaseConfig ¶
func (*Config) SetDefault ¶
type Context ¶
func (*Context) DefaultParamInt ¶
param int with default value defaultResult
func (*Context) DefaultParamInt64 ¶
param int64 with default value defaultResult
func (*Context) DefaultParamUint ¶
param uint with default value defaultResult
func (*Context) DefaultParamUint64 ¶
param uint64 with default value defaultResult
func (*Context) DefaultQueryInt ¶
query int with default value defaultResult
func (*Context) DefaultQueryInt64 ¶
query int64 with default value defaultResult
func (*Context) DefaultQueryUint ¶
query uint with default value defaultResult
func (*Context) DefaultQueryUint64 ¶
query uint64 with default value defaultResult
func (*Context) ParamUint64 ¶
param uint64
func (*Context) QueryUint64 ¶
query uint64
func (*Context) ShouldBindFailError ¶
ShouldBind data then fail error
func (*Context) ShouldBindValidateFailError ¶
ShouldBind & Validate data then fail error
func (*Context) ValidateFailError ¶
Validate data then fail error
type HandlerFunc ¶
type HandlerFunc func(*Context)