Documentation ¶
Index ¶
- func Cors() gin.HandlerFunc
- func RateLimit(redis *util.Redis, rate uint, period time.Duration) gin.HandlerFunc
- func WriteJsonError(c *gin.Context, code uint, msg string)
- func WriteJsonSuccess(c *gin.Context, data any)
- type CommonModel
- func (m *CommonModel) ClearGetHandlers(action string)
- func (m *CommonModel) ClearPostHandlers(action string)
- func (m *CommonModel) GetHandlers() map[string][]gin.HandlerFunc
- func (m *CommonModel) Name() string
- func (m *CommonModel) PostHandlers() map[string][]gin.HandlerFunc
- func (m *CommonModel) SetGetHandlers(action string, handles ...gin.HandlerFunc)
- func (m *CommonModel) SetPostHandlers(action string, handles ...gin.HandlerFunc)
- func (m *CommonModel) UseGetMiddlewares(action string, handles ...gin.HandlerFunc)
- func (m *CommonModel) UsePostMiddlewares(action string, handles ...gin.HandlerFunc)
- type Config
- func (c *Config) Get(key string) any
- func (c *Config) GetAll() map[string]any
- func (c *Config) GetBool(key string) bool
- func (c *Config) GetInt(key string) int
- func (c *Config) GetInt64(key string) int64
- func (c *Config) GetIntSlice(key string) []int
- func (c *Config) GetStrMap(key string) map[string]any
- func (c *Config) GetStrSlice(key string) []string
- func (c *Config) GetString(key string) string
- func (c *Config) LoadFromFile(filePath, fileType string) error
- func (c *Config) LoadFromRemote(provider, endpoint, path, cType string) error
- func (c *Config) SetDefault(key string, val any)
- type Engine
- func (e *Engine) RouterGet(group *gin.RouterGroup, path string, handlers ...gin.HandlerFunc) gin.IRoutes
- func (e *Engine) RouterGroup(path string, handlers ...gin.HandlerFunc) *gin.RouterGroup
- func (e *Engine) RouterPost(group *gin.RouterGroup, path string, handlers ...gin.HandlerFunc) gin.IRoutes
- func (e *Engine) RouterWithModel(group *gin.RouterGroup, model Model)
- func (e *Engine) Run(addr string, onClose func())
- func (e *Engine) UseMiddleware(middleware ...gin.HandlerFunc)
- type Logger
- func (l *Logger) Close()
- func (l *Logger) DPanic(msg string, fields ...zap.Field)
- func (l *Logger) Debug(msg string, fields ...zap.Field)
- func (l *Logger) Error(msg string, fields ...zap.Field)
- func (l *Logger) Fatal(msg string, fields ...zap.Field)
- func (l *Logger) Info(msg string, fields ...zap.Field)
- func (l *Logger) Panic(msg string, fields ...zap.Field)
- func (l *Logger) Warn(msg string, fields ...zap.Field)
- type Model
- type QueryKeyword
- type TableModel
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Cors ¶
func Cors() gin.HandlerFunc
func WriteJsonSuccess ¶
Types ¶
type CommonModel ¶
type CommonModel struct {
// contains filtered or unexported fields
}
func NewCommonModel ¶
func NewCommonModel(name string) *CommonModel
func (*CommonModel) ClearGetHandlers ¶
func (m *CommonModel) ClearGetHandlers(action string)
func (*CommonModel) ClearPostHandlers ¶
func (m *CommonModel) ClearPostHandlers(action string)
func (*CommonModel) GetHandlers ¶
func (m *CommonModel) GetHandlers() map[string][]gin.HandlerFunc
func (*CommonModel) Name ¶
func (m *CommonModel) Name() string
func (*CommonModel) PostHandlers ¶
func (m *CommonModel) PostHandlers() map[string][]gin.HandlerFunc
func (*CommonModel) SetGetHandlers ¶
func (m *CommonModel) SetGetHandlers(action string, handles ...gin.HandlerFunc)
func (*CommonModel) SetPostHandlers ¶
func (m *CommonModel) SetPostHandlers(action string, handles ...gin.HandlerFunc)
func (*CommonModel) UseGetMiddlewares ¶
func (m *CommonModel) UseGetMiddlewares(action string, handles ...gin.HandlerFunc)
func (*CommonModel) UsePostMiddlewares ¶
func (m *CommonModel) UsePostMiddlewares(action string, handles ...gin.HandlerFunc)
type Config ¶
func (*Config) GetIntSlice ¶
func (*Config) GetStrSlice ¶
func (*Config) LoadFromFile ¶
func (*Config) LoadFromRemote ¶
func (*Config) SetDefault ¶
type Engine ¶
func (*Engine) RouterGet ¶
func (e *Engine) RouterGet(group *gin.RouterGroup, path string, handlers ...gin.HandlerFunc) gin.IRoutes
func (*Engine) RouterGroup ¶
func (e *Engine) RouterGroup(path string, handlers ...gin.HandlerFunc) *gin.RouterGroup
func (*Engine) RouterPost ¶
func (e *Engine) RouterPost(group *gin.RouterGroup, path string, handlers ...gin.HandlerFunc) gin.IRoutes
func (*Engine) RouterWithModel ¶
func (e *Engine) RouterWithModel(group *gin.RouterGroup, model Model)
func (*Engine) UseMiddleware ¶
func (e *Engine) UseMiddleware(middleware ...gin.HandlerFunc)
type Model ¶
type Model interface { Name() string GetHandlers() map[string][]gin.HandlerFunc PostHandlers() map[string][]gin.HandlerFunc }
type QueryKeyword ¶
type TableModel ¶
type TableModel struct { Table *util.MysqlTable OrderBys map[string]string OrderByDefault string InfoFixer func(row *util.MysqlRow) error ListFixer func(row *util.MysqlRow) error InsertFixer func(row *util.MysqlRow) error UpdateFixer func(row *util.MysqlRow) error QueryKeyword *QueryKeyword CommonModel }
func NewTableModel ¶
func NewTableModel(mt *util.MysqlTable, alias string, qkd *QueryKeyword) *TableModel
func NewTableModelEasy ¶ added in v0.0.3
func NewTableModelEasy(tableName string, db *util.Mysql) *TableModel
Click to show internal directories.
Click to hide internal directories.