Documentation ¶
Index ¶
- func CaseCamel(ctx context.Context, table string, column string) string
- func CaseCamelUpper(ctx context.Context, table string, column string) string
- func CaseSnake(ctx context.Context, table string, column string) string
- func Ori(ctx context.Context, table string, column string) string
- func RegAccessListProvider(name string, provider AccessListProvider)
- func RegDbMetaProvider(name string, provider DbMetaProvider)
- func RegRequestListProvider(name string, provider RequestListProvider)
- type Access
- type AccessCondition
- type AccessConfig
- type AccessListProvider
- type ActionConfig
- func (c *ActionConfig) ConditionFunc(ctx context.Context, req ConditionReq, condition *ConditionRet) error
- func (c *ActionConfig) DefaultRoleFunc() DefaultRole
- func (c *ActionConfig) Func(name string) Func
- func (c *ActionConfig) GetAccessConfig(key string, noVerify bool) (*AccessConfig, error)
- func (c *ActionConfig) GetRequest(tag string, method string, version string) (*RequestConfig, error)
- func (c *ActionConfig) NoVerify() bool
- func (c *ActionConfig) RowKeyGen(ctx context.Context, genFuncName string, accessName string, data model.Map) (model.Map, error)
- type Column
- type ConditionReq
- type ConditionRet
- type Config
- func (c *Config) ActionConfig() *ActionConfig
- func (c *Config) QueryConfig() *QueryConfig
- func (c *Config) ReLoad()
- func (c *Config) RowKeyGen(ctx context.Context, genFuncName string, accessName string, data model.Map) (model.Map, error)
- func (c *Config) RowKeyGenFunc(name string, f RowKeyGenFuncHandler)
- func (c *Config) RowKeyGenList() []string
- type DBMeta
- type DbMetaProvider
- type DefaultRole
- type ExecutorConfig
- func (c *ExecutorConfig) AccessRoles() []string
- func (c *ExecutorConfig) Executor() string
- func (c *ExecutorConfig) GetFieldsGetByRole() *FieldsGetValue
- func (c *ExecutorConfig) GetFieldsGetInByRole() map[string][]string
- func (c *ExecutorConfig) GetFieldsGetOutByRole() []string
- func (c *ExecutorConfig) SetRole(role string)
- func (c *ExecutorConfig) TableColumns() []string
- func (c *ExecutorConfig) TableName() string
- type FieldStyle
- type FieldsGetValue
- type Func
- type ParamItem
- type QueryConfig
- func (c *QueryConfig) DefaultRoleFunc() DefaultRole
- func (c *QueryConfig) Func(name string) Func
- func (c *QueryConfig) GetAccessConfig(key string, noVerify bool) (*AccessConfig, error)
- func (c *QueryConfig) MaxTreeDeep() int
- func (c *QueryConfig) MaxTreeWidth() int
- func (c *QueryConfig) NoVerify() bool
- type RequestConfig
- type RequestConfigs
- type RequestListProvider
- type RoleReq
- type RowKeyGenFuncHandler
- type RowKeyGenReq
- type RowKeyGenRet
- type Structure
- type Table
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RegAccessListProvider ¶
func RegAccessListProvider(name string, provider AccessListProvider)
func RegDbMetaProvider ¶
func RegDbMetaProvider(name string, provider DbMetaProvider)
func RegRequestListProvider ¶
func RegRequestListProvider(name string, provider RequestListProvider)
Types ¶
type Access ¶
type Access struct { // 禁用_access权限校验, 默认为false, 需手动开启 NoVerify bool // 用于 根据accessName+user来自定义添加sql条件, 完成数据的权限限制 ConditionFunc AccessCondition // nodeRole 为前端显式指定的role, 需要此函数中判断该role是不是用户角色之一, 返回最终该节点的角色 DefaultRoleFunc DefaultRole // contains filtered or unexported fields }
func (*Access) GetAccess ¶
func (a *Access) GetAccess(tableAlias string, noVerify bool) (*AccessConfig, error)
func (*Access) GetAccessRole ¶
type AccessCondition ¶
type AccessCondition func(ctx context.Context, req ConditionReq, condition *ConditionRet) error
type AccessConfig ¶
type AccessConfig struct { Debug int8 Name string Alias string Get []string Head []string Gets []string Heads []string Post []string Put []string Delete []string CreatedAt *gtime.Time Detail string RowKeyGen string // 主键生成策略 RowKey string FieldsGet map[string]*FieldsGetValue Executor string }
func (*AccessConfig) GetFieldsGetInByRole ¶
func (a *AccessConfig) GetFieldsGetInByRole(role string) map[string][]string
func (*AccessConfig) GetFieldsGetOutByRole ¶
func (a *AccessConfig) GetFieldsGetOutByRole(role string) []string
type AccessListProvider ¶
type AccessListProvider func(ctx context.Context) []AccessConfig
type ActionConfig ¶
type ActionConfig struct {
// contains filtered or unexported fields
}
func (*ActionConfig) ConditionFunc ¶
func (c *ActionConfig) ConditionFunc(ctx context.Context, req ConditionReq, condition *ConditionRet) error
func (*ActionConfig) DefaultRoleFunc ¶
func (c *ActionConfig) DefaultRoleFunc() DefaultRole
func (*ActionConfig) Func ¶
func (c *ActionConfig) Func(name string) Func
func (*ActionConfig) GetAccessConfig ¶
func (c *ActionConfig) GetAccessConfig(key string, noVerify bool) (*AccessConfig, error)
func (*ActionConfig) GetRequest ¶
func (c *ActionConfig) GetRequest(tag string, method string, version string) (*RequestConfig, error)
func (*ActionConfig) NoVerify ¶
func (c *ActionConfig) NoVerify() bool
type ConditionReq ¶
type ConditionRet ¶
type ConditionRet struct {
// contains filtered or unexported fields
}
func NewConditionRet ¶
func NewConditionRet() *ConditionRet
func (*ConditionRet) Add ¶
func (c *ConditionRet) Add(k string, v any)
func (*ConditionRet) AddRaw ¶
func (c *ConditionRet) AddRaw(k string, v any)
func (*ConditionRet) Where ¶
func (c *ConditionRet) Where() map[string]any
type Config ¶
type Config struct { Access *Access Functions *functions MaxTreeWidth int MaxTreeDeep int // dbFieldStyle 数据库字段命名风格 请求传递到数据库中 DbFieldStyle FieldStyle // jsonFieldStyle 数据库返回的字段 JsonFieldStyle FieldStyle DbMeta *DBMeta AccessListProvider string RequestListProvider string DbMetaProvider string // contains filtered or unexported fields }
func (*Config) ActionConfig ¶
func (c *Config) ActionConfig() *ActionConfig
func (*Config) QueryConfig ¶
func (c *Config) QueryConfig() *QueryConfig
func (*Config) RowKeyGenFunc ¶
func (c *Config) RowKeyGenFunc(name string, f RowKeyGenFuncHandler)
func (*Config) RowKeyGenList ¶
type DBMeta ¶
type DBMeta struct {
// contains filtered or unexported fields
}
func (*DBMeta) GetTableColumns ¶
func (*DBMeta) GetTableNameList ¶
type DbMetaProvider ¶
type ExecutorConfig ¶
type ExecutorConfig struct { NoVerify bool DBMeta *DBMeta DbFieldStyle FieldStyle JsonFieldStyle FieldStyle // contains filtered or unexported fields }
func NewExecutorConfig ¶
func NewExecutorConfig(accessConfig *AccessConfig, method string, noVerify bool) *ExecutorConfig
func (*ExecutorConfig) AccessRoles ¶
func (c *ExecutorConfig) AccessRoles() []string
func (*ExecutorConfig) Executor ¶
func (c *ExecutorConfig) Executor() string
func (*ExecutorConfig) GetFieldsGetByRole ¶
func (c *ExecutorConfig) GetFieldsGetByRole() *FieldsGetValue
func (*ExecutorConfig) GetFieldsGetInByRole ¶
func (c *ExecutorConfig) GetFieldsGetInByRole() map[string][]string
func (*ExecutorConfig) GetFieldsGetOutByRole ¶
func (c *ExecutorConfig) GetFieldsGetOutByRole() []string
func (*ExecutorConfig) SetRole ¶
func (c *ExecutorConfig) SetRole(role string)
func (*ExecutorConfig) TableColumns ¶
func (c *ExecutorConfig) TableColumns() []string
func (*ExecutorConfig) TableName ¶
func (c *ExecutorConfig) TableName() string
type FieldsGetValue ¶
type QueryConfig ¶
type QueryConfig struct {
// contains filtered or unexported fields
}
func (*QueryConfig) DefaultRoleFunc ¶
func (c *QueryConfig) DefaultRoleFunc() DefaultRole
func (*QueryConfig) Func ¶
func (c *QueryConfig) Func(name string) Func
func (*QueryConfig) GetAccessConfig ¶
func (c *QueryConfig) GetAccessConfig(key string, noVerify bool) (*AccessConfig, error)
func (*QueryConfig) MaxTreeDeep ¶
func (c *QueryConfig) MaxTreeDeep() int
func (*QueryConfig) MaxTreeWidth ¶
func (c *QueryConfig) MaxTreeWidth() int
func (*QueryConfig) NoVerify ¶
func (c *QueryConfig) NoVerify() bool
type RequestConfig ¶
type RequestConfigs ¶
type RequestConfigs struct {
// contains filtered or unexported fields
}
func NewRequestConfig ¶
func NewRequestConfig(requestList []RequestConfig) *RequestConfigs
func (*RequestConfigs) GetRequest ¶
func (c *RequestConfigs) GetRequest(tag string, method string, version string) (*RequestConfig, error)
type RequestListProvider ¶
type RequestListProvider func(ctx context.Context) []RequestConfig
type RowKeyGenFuncHandler ¶
type RowKeyGenFuncHandler func(ctx context.Context, req *RowKeyGenReq, ret *RowKeyGenRet) error
type RowKeyGenReq ¶
type RowKeyGenRet ¶
type RowKeyGenRet struct {
// contains filtered or unexported fields
}
func NewRowKeyGenRet ¶
func NewRowKeyGenRet() *RowKeyGenRet
func (*RowKeyGenRet) RowKey ¶
func (r *RowKeyGenRet) RowKey(id any)
func (*RowKeyGenRet) RowKeys ¶
func (r *RowKeyGenRet) RowKeys(d model.Map)
type Structure ¶
type Structure struct { Must []string `json:"MUST,omitempty"` Refuse []string `json:"REFUSE,omitempty"` Unique []string `json:"UNIQUE,omitempty"` // 不存在时添加 Insert g.Map `json:"INSERT,omitempty"` // 不存在时就添加,存在时就修改 Update g.Map `json:"UPDATE,omitempty"` // 存在时替换 Replace g.Map `json:"REPLACE,omitempty"` // 存在时移除 Remove []string `json:"REMOVE,omitempty"` }
Source Files ¶
Click to show internal directories.
Click to hide internal directories.