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) ClearGinHandler(method string)
- func (m *CommonModel) GinHandlers() map[string]map[string][]gin.HandlerFunc
- func (m *CommonModel) RegisterGinHandler(method, path string, handlers ...gin.HandlerFunc) error
- func (m *CommonModel) UnregisterGinHandler(method, path string)
- func (m *CommonModel) UseGinMiddlewares(method, path string, handlers ...gin.HandlerFunc) error
- 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) RegisterRouter(group *gin.RouterGroup, method, path string, handlers ...gin.HandlerFunc) gin.IRoutes
- func (e *Engine) RouterGroup(path string, handlers ...gin.HandlerFunc) *gin.RouterGroup
- func (e *Engine) RouterWithModel(group *gin.RouterGroup, model Model)
- func (e *Engine) Run(addr string, onClose func())
- func (e *Engine) UseMiddlewares(middlewares ...gin.HandlerFunc)
- type IP2Region
- 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 Rbac
- func (r *Rbac) AddPermissionForRole(role string, vals ...string) (bool, error)
- func (r *Rbac) AddPermissionsForRole(role string, permissions ...[]string) (bool, error)
- func (r *Rbac) AddRoles(roles ...string) (bool, error)
- func (r *Rbac) AddRolesForUser(user string, roles ...string) (bool, error)
- func (r *Rbac) ClearPermissionsForRole(role string) (bool, error)
- func (r *Rbac) ClearRolesForUser(user string) (bool, error)
- func (r *Rbac) DeletePermissionForRole(role string, vals ...string) (bool, error)
- func (r *Rbac) DeleteRoles(roles ...string) error
- func (r *Rbac) DeleteRolesForUser(user string, roles ...string) error
- func (r *Rbac) DeleteUsers(users ...string) error
- func (r *Rbac) Enforce(role string, vals ...any) (bool, error)
- func (r *Rbac) GetAllRoles() ([]string, error)
- func (r *Rbac) GetImplicitRolesForUser(user string) ([]string, error)
- func (r *Rbac) GetPermissionsForRole(role string) ([][]string, error)
- func (r *Rbac) GetRolesForUser(user string) ([]string, error)
- func (r *Rbac) HasPermissionForRole(role string, vals ...string) (bool, error)
- func (r *Rbac) HasRoleForUser(user, role string) (bool, error)
- 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() *CommonModel
func (*CommonModel) ClearGinHandler ¶ added in v0.0.7
func (m *CommonModel) ClearGinHandler(method string)
func (*CommonModel) GinHandlers ¶ added in v0.0.7
func (m *CommonModel) GinHandlers() map[string]map[string][]gin.HandlerFunc
func (*CommonModel) RegisterGinHandler ¶ added in v0.0.7
func (m *CommonModel) RegisterGinHandler(method, path string, handlers ...gin.HandlerFunc) error
func (*CommonModel) UnregisterGinHandler ¶ added in v0.0.7
func (m *CommonModel) UnregisterGinHandler(method, path string)
func (*CommonModel) UseGinMiddlewares ¶ added in v0.0.7
func (m *CommonModel) UseGinMiddlewares(method, path string, handlers ...gin.HandlerFunc) error
type Config ¶
func (*Config) GetIntSlice ¶
func (*Config) GetStrSlice ¶
func (*Config) LoadFromFile ¶
func (*Config) LoadFromRemote ¶
func (*Config) SetDefault ¶
type Engine ¶
func (*Engine) RegisterRouter ¶ added in v0.0.7
func (e *Engine) RegisterRouter(group *gin.RouterGroup, method, path string, handlers ...gin.HandlerFunc) gin.IRoutes
func (*Engine) RouterGroup ¶
func (e *Engine) RouterGroup(path string, handlers ...gin.HandlerFunc) *gin.RouterGroup
func (*Engine) RouterWithModel ¶
func (e *Engine) RouterWithModel(group *gin.RouterGroup, model Model)
func (*Engine) UseMiddlewares ¶ added in v0.0.7
func (e *Engine) UseMiddlewares(middlewares ...gin.HandlerFunc)
type IP2Region ¶ added in v0.0.7
type IP2Region struct {
// contains filtered or unexported fields
}
func NewIP2Region ¶ added in v0.0.7
type QueryKeyword ¶
type QueryKeyword struct { Page string PageSize string OrderBy string SoColumn string SoWord string }
func (*QueryKeyword) Words ¶ added in v0.0.11
func (kw *QueryKeyword) Words() []string
type Rbac ¶ added in v0.0.5
type Rbac struct { Adapter *gormadapter.Adapter Enforcer *casbin.SyncedCachedEnforcer SuperAdmin string UserNone string }
Rbac RBAC结构体
func (*Rbac) AddPermissionForRole ¶ added in v0.0.5
AddPermissionForRole 给角色添加一个资源的操作权限
func (*Rbac) AddPermissionsForRole ¶ added in v0.0.5
AddPermissionsForRole 给角色或用户,添加一个或多个资源的操作权限
func (*Rbac) AddRolesForUser ¶ added in v0.0.5
AddRolesForUser 向用户(或角色)绑定一个或多个角色
func (*Rbac) ClearPermissionsForRole ¶ added in v0.0.5
ClearPermissionsForRole 清空角色的权限
func (*Rbac) ClearRolesForUser ¶ added in v0.0.5
ClearRolesForUser 清空用户的角色
func (*Rbac) DeletePermissionForRole ¶ added in v0.0.5
DeletePermissionForRole 删除角色对资源的操作权限
func (*Rbac) DeleteRoles ¶ added in v0.0.5
DeleteRoles 删除一个或多个角色
func (*Rbac) DeleteRolesForUser ¶ added in v0.0.5
DeleteRolesForUser 删除用户的一个或多个角色
func (*Rbac) DeleteUsers ¶ added in v0.0.5
DeleteUsers 删除一个或多个用户
func (*Rbac) GetAllRoles ¶ added in v0.0.5
GetAllRoles 获得全部角色名
func (*Rbac) GetImplicitRolesForUser ¶ added in v0.0.5
GetImplicitRolesForUser 获得用户的角色(一个或多个,包含隐式层级)
func (*Rbac) GetPermissionsForRole ¶ added in v0.0.5
GetPermissionsForRole 获取角色的权限,不包含隐式
func (*Rbac) GetRolesForUser ¶ added in v0.0.5
GetRolesForUser 获得用户的角色(一个或多个)
func (*Rbac) HasPermissionForRole ¶ added in v0.0.6
HasPermissionForRole 角色或用户,对某资料是否有操作权限(不包含隐式)
type TableModel ¶
type TableModel struct { Table *util2.MysqlTable OrderBys map[string]string InfoFixer func(c *gin.Context, row *util2.MysqlRow) error QueryFixer func(c *gin.Context, k string, v []string, p []any) (w, k1 string, p1 []any, ctn bool, err error) ListFixer func(c *gin.Context, row *util2.MysqlRow) error InsertFixer func(c *gin.Context, row *util2.MysqlRow) error UpdateFixer func(c *gin.Context, row *util2.MysqlRow) error QueryKeyword *QueryKeyword CommonModel Alias string OrderByDefault string SoColumns []string PageSizeMax int64 }
func NewTableModel ¶
func NewTableModel(mt *util2.MysqlTable, alias string, qkd *QueryKeyword) *TableModel
func NewTableModelEasy ¶ added in v0.0.3
func NewTableModelEasy(tableName string, db *util2.MysqlClient) *TableModel
Source Files ¶
Click to show internal directories.
Click to hide internal directories.