Documentation
¶
Index ¶
- Constants
- Variables
- func ActionRun(ctx iris.Context, model IModelItem, user *SimpleUserModel)
- func ArrayIn[T comparable](value T, arr []T) bool
- func ChangeRecordOperationLog(b bool)
- func CheckConditions(data map[string]interface{}, conds []ut.Kov) (bool, string)
- func DynamicRun(ctx iris.Context, model IModelItem, user *SimpleUserModel)
- func IrisRespErr(msg string, err error, ctx iris.Context, code ...int)
- func MustOpLog(ctx iris.Context, db *qmgo.Collection, method string, user *SimpleUserModel, ...)
- func OpLogSyncIndex(ctx context.Context, coll *qmgo.Collection) error
- func ToJsonSchema[T any](origin T, omitFields ...string) *jsonschema.Schema
- type ActionPostArgs
- type ActionPostPart
- type Backend
- func (c *Backend) AddDb(mdb *qmgo.Database)
- func (b *Backend) AddDbModel(raw pipe.IMongoModel) IModelItem
- func (b *Backend) AddModel(m IModelItem)
- func (b *Backend) AddModelAny(raw any) IModelItem
- func (c *Backend) AddRbac(rbac *pipe.RbacDomain)
- func (c *Backend) AddRbacUseUri(redisAddress, password string) bool
- func (c *Backend) AddRdb(rdb rueidis.Client)
- func (c *Backend) CloneConn() *connectInfo
- func (c *Backend) Db() *qmgo.Database
- func (b *Backend) GetModel(name string) (IModelItem, bool)
- func (b *Backend) GetMsgHandler(ctx iris.Context)
- func (c *Backend) GetRbac() *pipe.RbacDomain
- func (b *Backend) InsertLogModel()
- func (b *Backend) InsertUserModel()
- func (c *Backend) OpLog() *qmgo.Collection
- func (b *Backend) RegistryRoute(party iris.Party)
- func (b *Backend) SendMsg(ctx context.Context, uid, content string)
- func (c *Backend) SetConn(conn *connectInfo)
- type ContextValueInject
- type DynamicCall
- type DynamicField
- type DynamicReq
- type DynamicResult
- type EmailPasswordLoginReq
- type IModelItem
- type ISchemaAction
- type ISchemaMode
- type ImgCaptcha
- type ImgCaptchaItem
- type ManySchema
- type Message
- type MessageQueue
- type OperationLog
- type Platform
- type RoleUpLoginReq
- type SchemaActionBase
- type SchemaAllowMethods
- func (c *SchemaAllowMethods) ChangeDelete(status bool)
- func (c *SchemaAllowMethods) ChangeGetAll(status bool)
- func (c *SchemaAllowMethods) ChangeGetSingle(status bool)
- func (c *SchemaAllowMethods) ChangePost(status bool)
- func (c *SchemaAllowMethods) ChangePut(status bool)
- func (c *SchemaAllowMethods) OnlyGet(status bool)
- type SchemaBase
- type SchemaGetResp
- type SchemaHooks
- type SchemaIframe
- type SchemaModel
- func (s *SchemaModel[T]) ActionEntry(ctx iris.Context)
- func (s *SchemaModel[T]) AddAction(action ISchemaAction)
- func (s *SchemaModel[T]) AddDF(id, name string, call DynamicCall)
- func (s *SchemaModel[T]) AddDynamicField(f *DynamicField)
- func (s *SchemaModel[T]) AddQueryContextInject(q ContextValueInject)
- func (s *SchemaModel[T]) AddQueryFilterInject(fl *ut.Kov)
- func (s *SchemaModel[T]) CrudHandler(ctx iris.Context)
- func (s *SchemaModel[T]) DelHandler(ctx iris.Context, params pipe.ModelDelConfig) error
- func (s *SchemaModel[T]) DfIdFind(id string) *DynamicField
- func (s *SchemaModel[T]) DynamicFieldsEntry(ctx iris.Context)
- func (s *SchemaModel[T]) GeneratorParty(parentParty iris.Party, contextHandlers ...iris.Handler) iris.Party
- func (s *SchemaModel[T]) GetAction(name string) (ISchemaAction, bool)
- func (s *SchemaModel[T]) GetAllAction() []ISchemaAction
- func (s *SchemaModel[T]) GetBase() SchemaBase
- func (s *SchemaModel[T]) GetCollection() *qmgo.Collection
- func (s *SchemaModel[T]) GetContextUser(ctx iris.Context) *SimpleUserModel
- func (s *SchemaModel[T]) GetDb() *qmgo.Database
- func (s *SchemaModel[T]) GetHandler(ctx iris.Context, queryParams pipe.QueryParseConfig, ...) error
- func (s *SchemaModel[T]) GetRoles() *SchemaRole
- func (s *SchemaModel[T]) GetSchema(mode ISchemaMode) *jsonschema.Schema
- func (s *SchemaModel[T]) GetSelf() *SchemaModel[T]
- func (s *SchemaModel[T]) GetTableName() string
- func (s *SchemaModel[T]) HaveUserKey(schema *jsonschema.Schema) bool
- func (s *SchemaModel[T]) MarshalJSON() ([]byte, error)
- func (s *SchemaModel[T]) ParseInject(ctx iris.Context) ([]*ut.Kov, error)
- func (s *SchemaModel[T]) PostHandler(ctx iris.Context, params ut.ModelCtxMapperPack) error
- func (s *SchemaModel[T]) PutHandler(ctx iris.Context, params pipe.ModelPutConfig) error
- func (s *SchemaModel[T]) Registry(parentParty iris.Party)
- func (s *SchemaModel[T]) RegistryConfigAction(p iris.Party)
- func (s *SchemaModel[T]) RegistryCrud(p iris.Party)
- func (s *SchemaModel[T]) SetFilterCanPass(...)
- func (s *SchemaModel[T]) SetPathId(newId string)
- func (s *SchemaModel[T]) SetRaw(raw any)
- func (s *SchemaModel[T]) SetSchema(mode ISchemaMode, schema *jsonschema.Schema)
- func (s *SchemaModel[T]) SetSchemaRaw(mode ISchemaMode, raw any)
- type SchemaModelAction
- type SchemaRole
- type SchemaTableDisable
- type SimpleUserHooks
- type SimpleUserModel
- func (c *SimpleUserModel) AddDb(mdb *qmgo.Database)
- func (c *SimpleUserModel) AddRbac(rbac *pipe.RbacDomain)
- func (c *SimpleUserModel) AddRbacUseUri(redisAddress, password string) bool
- func (c *SimpleUserModel) AddRdb(rdb rueidis.Client)
- func (c *SimpleUserModel) AppidGetPlatform(appid string) *pipe.AccountPlatform
- func (c *SimpleUserModel) CanRole(ctx context.Context, uid string, roles []string) bool
- func (c *SimpleUserModel) ChangePassword(useValid bool) iris.Handler
- func (c *SimpleUserModel) CloneConn() *connectInfo
- func (c *SimpleUserModel) Db() *qmgo.Database
- func (c *SimpleUserModel) FuzzGetUser(ctx context.Context, idOrName string) (*SimpleUserModel, error)
- func (c *SimpleUserModel) GenJwtToken(ctx iris.Context, force bool, strict bool) (string, error)
- func (c *SimpleUserModel) GetCollName() string
- func (c *SimpleUserModel) GetRbac() *pipe.RbacDomain
- func (c *SimpleUserModel) GetUid() string
- func (c *SimpleUserModel) GetUserItem(ctx context.Context, filter bson.M) (*SimpleUserModel, error)
- func (c *SimpleUserModel) LoginUseEmailHandler(useValid bool) iris.Handler
- func (c *SimpleUserModel) LoginUseUserNameHandler(useValid bool) iris.Handler
- func (c *SimpleUserModel) Masking(level int) *SimpleUserModel
- func (c *SimpleUserModel) MustLoginMiddleware() iris.Handler
- func (c *SimpleUserModel) OpLog() *qmgo.Collection
- func (c *SimpleUserModel) OpenIdGetPlatform(openid string) *pipe.AccountPlatform
- func (c *SimpleUserModel) PlatformIsExist(name string) bool
- func (c *SimpleUserModel) RegistryUseUserNameHandler(useValid bool) iris.Handler
- func (c *SimpleUserModel) RemoveUser(ctx context.Context, uid string) error
- func (c *SimpleUserModel) RoleSecret() string
- func (c *SimpleUserModel) RoleSetHandler() iris.Handler
- func (c *SimpleUserModel) SetConn(conn *connectInfo)
- func (c *SimpleUserModel) SetHooks(hooks *SimpleUserHooks)
- func (c *SimpleUserModel) SetRole(ctx context.Context, filters bson.M, roleTarget string) error
- func (c *SimpleUserModel) SetRoleSecret(roleSecret string)
- func (c *SimpleUserModel) SetRoleUseEmail(ctx context.Context, email string, roleTarget string) error
- func (c *SimpleUserModel) SetRoleUsePhone(ctx context.Context, phone string, roleTarget string) error
- func (c *SimpleUserModel) SetRoleUseUid(ctx context.Context, uid string, roleTarget string) error
- func (c *SimpleUserModel) SetRoleUseUserName(ctx context.Context, userName string, roleTarget string) error
- func (c *SimpleUserModel) SyncIndex(ctx context.Context) error
- type UserChangePasswordReq
- type UserModel
- type UserPasswordLoginReq
- type UserRegLoginReq
Constants ¶
View Source
const ( UserModelName = "users" UserContextKey = "user_model" UserIdContextKey = "user_model_id" )
Variables ¶
View Source
var ( ErrCaptchaNotFound = errors.New("验证码不存在或已过期") ErrCaptchaMismatch = errors.New("验证码不匹配") )
定义验证码相关的错误类型
View Source
var ( UserInstance = NewUserModel() UserIdFieldName = "user_id" UserCookieKey = "tk" )
View Source
var (
ImgCaptchaInst = NewImgCaptcha()
)
View Source
var (
RecordOperationLog = true
)
Functions ¶
func ActionRun ¶
func ActionRun(ctx iris.Context, model IModelItem, user *SimpleUserModel)
func ArrayIn ¶
func ArrayIn[T comparable](value T, arr []T) bool
func ChangeRecordOperationLog ¶
func ChangeRecordOperationLog(b bool)
func CheckConditions ¶
func DynamicRun ¶
func DynamicRun(ctx iris.Context, model IModelItem, user *SimpleUserModel)
func OpLogSyncIndex ¶
func OpLogSyncIndex(ctx context.Context, coll *qmgo.Collection) error
func ToJsonSchema ¶
func ToJsonSchema[T any](origin T, omitFields ...string) *jsonschema.Schema
ToJsonSchema 把一个struct转换为jsonschema 在后台的前端ui-schema中不支持patternProperties 也就是说不支持map[string]any的写法 omitFields 是需要跳过的字段名 是struct的字段名
Types ¶
type ActionPostArgs ¶
type ActionPostArgs[T, F any] struct { Rows []T `json:"rows"` FormData F `json:"form_data"` User *SimpleUserModel `json:"user"` Model IModelItem `json:"model"` }
ActionPostArgs T是行数据 F是表单数据
type ActionPostPart ¶
type Backend ¶
type Backend struct {
Prefix string
LoginUseValid bool
RegUseValid bool
ValidHard gocaptcha.CaptchaDifficulty
// contains filtered or unexported fields
}
var (
BkInst *Backend
)
func NewBackend ¶
func NewBackend() *Backend
func NewFullBackend ¶
func (*Backend) AddDbModel ¶
func (b *Backend) AddDbModel(raw pipe.IMongoModel) IModelItem
func (*Backend) AddModel ¶
func (b *Backend) AddModel(m IModelItem)
func (*Backend) AddModelAny ¶
func (b *Backend) AddModelAny(raw any) IModelItem
func (*Backend) AddRbac ¶
func (c *Backend) AddRbac(rbac *pipe.RbacDomain)
func (*Backend) AddRbacUseUri ¶
func (*Backend) GetMsgHandler ¶
func (*Backend) GetRbac ¶
func (c *Backend) GetRbac() *pipe.RbacDomain
func (*Backend) InsertLogModel ¶
func (b *Backend) InsertLogModel()
func (*Backend) InsertUserModel ¶
func (b *Backend) InsertUserModel()
func (*Backend) OpLog ¶
func (c *Backend) OpLog() *qmgo.Collection
func (*Backend) RegistryRoute ¶
type ContextValueInject ¶
type DynamicCall ¶
type DynamicCall func(fieldId string, model IModelItem, user *SimpleUserModel, row map[string]any) (*DynamicResult, error)
type DynamicField ¶
type DynamicField struct {
Id string `json:"id"` // 字段唯一id
Name string `json:"name"` // 字段名
Trigger string `json:"trigger"` // 触发方式 默认interval
// contains filtered or unexported fields
}
func NewDynamicField ¶
func NewDynamicField(id, name string) *DynamicField
func (*DynamicField) AddCall ¶
func (c *DynamicField) AddCall(call DynamicCall) *DynamicField
func (*DynamicField) SetTrigger ¶
func (c *DynamicField) SetTrigger(trigger string) *DynamicField
func (*DynamicField) SetTriggerClick ¶
func (c *DynamicField) SetTriggerClick() *DynamicField
func (*DynamicField) SetTriggerInterval ¶
func (c *DynamicField) SetTriggerInterval() *DynamicField
type DynamicReq ¶
type DynamicResult ¶
func (*DynamicResult) Normal ¶
func (r *DynamicResult) Normal(data string)
func (*DynamicResult) Raw ¶
func (r *DynamicResult) Raw(data any)
type EmailPasswordLoginReq ¶
type EmailPasswordLoginReq struct {
Email string `json:"email,omitempty" comment:"邮箱号码" validate:"required,email"`
Password string `json:"password,omitempty" comment:"密码" validate:"required,min=6,max=36"`
Force bool `json:"force,omitempty" comment:"强制"`
Strict bool `json:"strict,omitempty" comment:"严苛模式"`
ValidId string `json:"valid_id,omitempty" comment:"验证码id"`
ValidValue string `json:"valid_value,omitempty" comment:"验证码值"`
}
type IModelItem ¶
type IModelItem interface {
GetBase() SchemaBase
SetRaw(raw any)
AddAction(action ISchemaAction)
GetAction(name string) (ISchemaAction, bool)
AddQueryFilterInject(fl *ut.Kov)
ParseInject(ctx iris.Context) ([]*ut.Kov, error)
GetCollection() *qmgo.Collection
GetDb() *qmgo.Database
GetTableName() string
GetHandler(ctx iris.Context, queryParams pipe.QueryParseConfig, getParams pipe.ModelGetData, uid string) error
PostHandler(ctx iris.Context, params ut.ModelCtxMapperPack) error
PutHandler(ctx iris.Context, params pipe.ModelPutConfig) error
DelHandler(ctx iris.Context, params pipe.ModelDelConfig) error
ActionEntry(ctx iris.Context)
DynamicFieldsEntry(ctx iris.Context)
Registry(part iris.Party)
GeneratorParty(part iris.Party, contextHandlers ...iris.Handler) iris.Party
RegistryConfigAction(p iris.Party)
RegistryCrud(p iris.Party)
CrudHandler(ctx iris.Context)
AddQueryContextInject(q ContextValueInject)
GetContextUser(ctx iris.Context) *SimpleUserModel
GetAllAction() []ISchemaAction
SetPathId(newId string)
GetRoles() *SchemaRole
HaveUserKey(schema *jsonschema.Schema) bool
GetSchema(mode ISchemaMode) *jsonschema.Schema
SetSchemaRaw(mode ISchemaMode, raw any)
SetSchema(mode ISchemaMode, schema *jsonschema.Schema)
AddDynamicField(f *DynamicField)
AddDF(id, name string, call DynamicCall)
DfIdFind(id string) *DynamicField
}
type ISchemaAction ¶
type ISchemaAction interface {
Execute(ctx iris.Context, args any) (responseInfo any, err error)
GetBase() *SchemaActionBase
SetCall(func(ctx iris.Context, args any) (responseInfo any, err error))
}
func NewAction ¶
func NewAction[T any, F any](name string, form F) ISchemaAction
NewAction action的名称必填 form没有可传nil
func NewRowAction ¶
func NewRowAction[T any, F any](name string, form F) ISchemaAction
func NewTableAction ¶
func NewTableAction[T any, F any](name string, form F) ISchemaAction
type ISchemaMode ¶
type ISchemaMode int
const ( SchemaModeAdd ISchemaMode = iota SchemaModeEdit SchemaModeTable SchemaModeDelete )
type ImgCaptcha ¶
type ImgCaptcha struct {
Records map[string]ImgCaptchaItem
// contains filtered or unexported fields
}
func NewImgCaptcha ¶
func NewImgCaptcha() *ImgCaptcha
func (*ImgCaptcha) GetNewImg ¶
func (c *ImgCaptcha) GetNewImg(width, height int, textSize int, difficulty gocaptcha.CaptchaDifficulty) (string, []byte, error)
type ImgCaptchaItem ¶
type ManySchema ¶
type ManySchema struct {
Table *jsonschema.Schema `json:"table"`
Edit *jsonschema.Schema `json:"edit"`
Add *jsonschema.Schema `json:"add"`
Delete *jsonschema.Schema `json:"delete"`
}
type MessageQueue ¶
type MessageQueue struct {
// contains filtered or unexported fields
}
func NewMessageQueue ¶
func NewMessageQueue() *MessageQueue
func (*MessageQueue) Put ¶
func (mq *MessageQueue) Put(uid, content string)
type OperationLog ¶
type OperationLog struct {
pipe.ModelBase `bson:",inline"`
Method string `json:"method,omitempty" bson:"method,omitempty" comment:"操作方法"`
UserId string `json:"user_id,omitempty" bson:"user_id,omitempty" comment:"操作用户ID"`
UserName string `json:"user_name,omitempty" bson:"user_name,omitempty" comment:"操作用户名"`
ToSheet string `json:"to_sheet,omitempty" bson:"to_sheet,omitempty" comment:"操作的表名"`
ToRowId string `json:"to_row_id,omitempty" bson:"to_row_id,omitempty" comment:"行ID"`
ToFields []ut.Kov `json:"to_fields,omitempty" bson:"to_fields,omitempty" comment:"字段内容"`
Msg string `json:"msg,omitempty" bson:"msg,omitempty" comment:"消息"`
}
type Platform ¶
type Platform struct {
Name string `json:"name,omitempty" bson:"name,omitempty" comment:"平台名称"`
Id string `json:"id,omitempty" bson:"id,omitempty" comment:"平台唯一ID"`
NickName string `json:"nick_name,omitempty" bson:"nick_name,omitempty" comment:"平台昵称"`
AvatarUrl string `json:"avatar_url,omitempty" bson:"avatar_url,omitempty" comment:"平台头像"`
Data string `json:"data,omitempty" bson:"data,omitempty" comment:"平台数据"`
}
type RoleUpLoginReq ¶
type SchemaActionBase ¶
type SchemaActionBase struct {
Name string `json:"name,omitempty"` // 动作名称 需要唯一
Prefix string `json:"prefix,omitempty"` // 前缀标识 仅展示用
Types []uint `json:"types,omitempty"` // 0 表可用 1 行可用
Form *jsonschema.Schema `json:"form,omitempty"` // 若form为nil 则不会弹出表单填写
MustSelect bool `json:"must_select,omitempty"` // 必须有所选择表选择适用 行是必须选一行
TableEmptySelectUseAllSheet bool `json:"table_empty_select_use_all_sheet"` // 表模式未选中行则默认是整表
Conditions []ut.Kov `json:"conditions,omitempty"` // 选中/执行的前置条件 判断数据为选中的每一行数据 常用场景为 限定只有字段a=b时才可用或a!=b时 挨个执行 任意一个不成功都返回
FaWarning bool `json:"fa_warning,omitempty"` // 是否弹出二次确认操作
}
func (*SchemaActionBase) AddCondition ¶
func (s *SchemaActionBase) AddCondition(cond ut.Kov)
func (*SchemaActionBase) SetForm ¶
func (s *SchemaActionBase) SetForm(raw any)
func (*SchemaActionBase) SetType ¶
func (s *SchemaActionBase) SetType(tp []uint)
type SchemaAllowMethods ¶
type SchemaAllowMethods struct {
GetAll bool `json:"get_all"`
GetSingle bool `json:"get_single"`
Post bool `json:"post"`
Put bool `json:"put"`
Delete bool `json:"delete"`
}
func (*SchemaAllowMethods) ChangeDelete ¶
func (c *SchemaAllowMethods) ChangeDelete(status bool)
func (*SchemaAllowMethods) ChangeGetAll ¶
func (c *SchemaAllowMethods) ChangeGetAll(status bool)
func (*SchemaAllowMethods) ChangeGetSingle ¶
func (c *SchemaAllowMethods) ChangeGetSingle(status bool)
func (*SchemaAllowMethods) ChangePost ¶
func (c *SchemaAllowMethods) ChangePost(status bool)
func (*SchemaAllowMethods) ChangePut ¶
func (c *SchemaAllowMethods) ChangePut(status bool)
func (*SchemaAllowMethods) OnlyGet ¶
func (c *SchemaAllowMethods) OnlyGet(status bool)
type SchemaBase ¶
type SchemaBase struct {
Group string `json:"group,omitempty"` // 组名
Priority int `json:"priority,omitempty"` // 在组下显示的优先级 越大越优先
TableName string `json:"table_name,omitempty"` // 表名
UniqueId string `json:"unique_id,omitempty"` // 唯一ID 默认生成sonyflakeId
PathId string `json:"path_id,omitempty"` // 路径ID 默认取UniqueId 在加入backend时会自动修改
RawName string `json:"raw_name,omitempty"` // 原始名称
Alias string `json:"alias,omitempty"` // 别名 中文名
}
type SchemaGetResp ¶
type SchemaGetResp struct {
*ut.MongoFacetResult
Page int64 `json:"page,omitempty"`
PageSize int64 `json:"page_size,omitempty"`
Sorts *ut.BaseSort `json:"sorts,omitempty"`
Filters *ut.QueryParse `json:"filters,omitempty"`
}
type SchemaHooks ¶
type SchemaHooks[T any] struct { CustomAddHandler func(ctx iris.Context, params ut.ModelCtxMapperPack, model *SchemaModel[T]) error OnAddBefore func(ctx iris.Context, args *pipe.RunResp[any], model *SchemaModel[T]) error // 在新增之前 OnAddAfter func(ctx iris.Context, args *pipe.RunResp[map[string]any], model *SchemaModel[T]) error // 在新增之后 OnGetBefore func(ctx iris.Context, args *pipe.RunResp[*ut.QueryFull], params *pipe.ModelGetData, model *SchemaModel[T]) error // 在获取之前 OnGetAfter func(ctx iris.Context, args *pipe.RunResp[*ut.MongoFacetResult], model *SchemaModel[T]) error // 在获取之后 OnEditBefore func(ctx iris.Context, args pipe.ModelPutConfig, model *SchemaModel[T]) error // 在修改之前 OnEditAfter func(ctx iris.Context, args *pipe.RunResp[map[string]any], model *SchemaModel[T]) error // 在修改之后 OnDelBefore func(ctx iris.Context, args pipe.ModelDelConfig, model *SchemaModel[T]) error // 在删除之前 OnDelAfter func(ctx iris.Context, args *pipe.RunResp[any], model *SchemaModel[T]) error // 在删除之后 }
type SchemaIframe ¶
type SchemaIframe struct {
Url string `json:"url,omitempty"`
}
type SchemaModel ¶
type SchemaModel[T any] struct { SchemaBase Roles *SchemaRole `json:"roles,omitempty"` Schemas ManySchema `json:"schemas"` Iframe *SchemaIframe `json:"iframe,omitempty"` TableDisable *SchemaTableDisable `json:"table_disable,omitempty"` Actions []ISchemaAction `json:"actions,omitempty"` // 各类操作 DynamicFields []*DynamicField `json:"dynamic_fields,omitempty"` // 动态字段 AllowMethods *SchemaAllowMethods `json:"allow_methods"` GetHandlerConfig pipe.QueryParseConfig PostHandlerConfig ut.ModelCtxMapperPack PutHandlerConfig pipe.ModelPutConfig DeleteHandlerConfig pipe.ModelDelConfig Debug bool WriteInsert bool `json:"write_insert,omitempty"` // 是否把注入内容写入新增体 PostMustKeys []string `json:"post_must_keys,omitempty"` // 新增时候必须存在的key Hooks SchemaHooks[T] // contains filtered or unexported fields }
func NewSchemaModel ¶
func NewSchemaModel[T any](raw T, db *qmgo.Database) *SchemaModel[T]
func (*SchemaModel[T]) ActionEntry ¶
func (s *SchemaModel[T]) ActionEntry(ctx iris.Context)
func (*SchemaModel[T]) AddAction ¶
func (s *SchemaModel[T]) AddAction(action ISchemaAction)
func (*SchemaModel[T]) AddDF ¶
func (s *SchemaModel[T]) AddDF(id, name string, call DynamicCall)
func (*SchemaModel[T]) AddDynamicField ¶
func (s *SchemaModel[T]) AddDynamicField(f *DynamicField)
func (*SchemaModel[T]) AddQueryContextInject ¶
func (s *SchemaModel[T]) AddQueryContextInject(q ContextValueInject)
func (*SchemaModel[T]) AddQueryFilterInject ¶
func (s *SchemaModel[T]) AddQueryFilterInject(fl *ut.Kov)
func (*SchemaModel[T]) CrudHandler ¶
func (s *SchemaModel[T]) CrudHandler(ctx iris.Context)
func (*SchemaModel[T]) DelHandler ¶
func (s *SchemaModel[T]) DelHandler(ctx iris.Context, params pipe.ModelDelConfig) error
func (*SchemaModel[T]) DfIdFind ¶
func (s *SchemaModel[T]) DfIdFind(id string) *DynamicField
func (*SchemaModel[T]) DynamicFieldsEntry ¶
func (s *SchemaModel[T]) DynamicFieldsEntry(ctx iris.Context)
func (*SchemaModel[T]) GeneratorParty ¶
func (*SchemaModel[T]) GetAction ¶
func (s *SchemaModel[T]) GetAction(name string) (ISchemaAction, bool)
func (*SchemaModel[T]) GetAllAction ¶
func (s *SchemaModel[T]) GetAllAction() []ISchemaAction
func (*SchemaModel[T]) GetBase ¶
func (s *SchemaModel[T]) GetBase() SchemaBase
func (*SchemaModel[T]) GetCollection ¶
func (s *SchemaModel[T]) GetCollection() *qmgo.Collection
func (*SchemaModel[T]) GetContextUser ¶
func (s *SchemaModel[T]) GetContextUser(ctx iris.Context) *SimpleUserModel
func (*SchemaModel[T]) GetDb ¶
func (s *SchemaModel[T]) GetDb() *qmgo.Database
func (*SchemaModel[T]) GetHandler ¶
func (s *SchemaModel[T]) GetHandler(ctx iris.Context, queryParams pipe.QueryParseConfig, getParams pipe.ModelGetData, uid string) error
GetHandler 仅获取数据
func (*SchemaModel[T]) GetRoles ¶
func (s *SchemaModel[T]) GetRoles() *SchemaRole
func (*SchemaModel[T]) GetSchema ¶
func (s *SchemaModel[T]) GetSchema(mode ISchemaMode) *jsonschema.Schema
func (*SchemaModel[T]) GetSelf ¶
func (s *SchemaModel[T]) GetSelf() *SchemaModel[T]
func (*SchemaModel[T]) GetTableName ¶
func (s *SchemaModel[T]) GetTableName() string
func (*SchemaModel[T]) HaveUserKey ¶
func (s *SchemaModel[T]) HaveUserKey(schema *jsonschema.Schema) bool
func (*SchemaModel[T]) MarshalJSON ¶
func (s *SchemaModel[T]) MarshalJSON() ([]byte, error)
func (*SchemaModel[T]) ParseInject ¶
func (*SchemaModel[T]) PostHandler ¶
func (s *SchemaModel[T]) PostHandler(ctx iris.Context, params ut.ModelCtxMapperPack) error
PostHandler 新增数据
func (*SchemaModel[T]) PutHandler ¶
func (s *SchemaModel[T]) PutHandler(ctx iris.Context, params pipe.ModelPutConfig) error
func (*SchemaModel[T]) Registry ¶
func (s *SchemaModel[T]) Registry(parentParty iris.Party)
func (*SchemaModel[T]) RegistryConfigAction ¶
func (s *SchemaModel[T]) RegistryConfigAction(p iris.Party)
func (*SchemaModel[T]) RegistryCrud ¶
func (s *SchemaModel[T]) RegistryCrud(p iris.Party)
func (*SchemaModel[T]) SetFilterCanPass ¶
func (s *SchemaModel[T]) SetFilterCanPass(filterCanPass func(ctx iris.Context, self *SchemaModel[T], query *ut.QueryFull) error)
func (*SchemaModel[T]) SetPathId ¶
func (s *SchemaModel[T]) SetPathId(newId string)
func (*SchemaModel[T]) SetRaw ¶
func (s *SchemaModel[T]) SetRaw(raw any)
func (*SchemaModel[T]) SetSchema ¶
func (s *SchemaModel[T]) SetSchema(mode ISchemaMode, schema *jsonschema.Schema)
func (*SchemaModel[T]) SetSchemaRaw ¶
func (s *SchemaModel[T]) SetSchemaRaw(mode ISchemaMode, raw any)
type SchemaModelAction ¶
type SchemaModelAction[T, F any] struct { SchemaActionBase // contains filtered or unexported fields }
SchemaModelAction 模型action T是模型数据 F是表单数据
func NewSchemaModelAction ¶
func NewSchemaModelAction[T, F any]() *SchemaModelAction[T, F]
func (*SchemaModelAction[T, F]) GetBase ¶
func (s *SchemaModelAction[T, F]) GetBase() *SchemaActionBase
type SchemaRole ¶
type SchemaTableDisable ¶
type SimpleUserHooks ¶
type SimpleUserHooks struct {
OnLoginAfter func(ctx iris.Context, user *SimpleUserModel, token string) error
}
type SimpleUserModel ¶
type SimpleUserModel struct {
pipe.GenericsAccount `bson:",inline"`
// contains filtered or unexported fields
}
func NewUserModel ¶
func NewUserModel(conn ...connectInfo) *SimpleUserModel
func (*SimpleUserModel) AddRbac ¶
func (c *SimpleUserModel) AddRbac(rbac *pipe.RbacDomain)
func (*SimpleUserModel) AddRbacUseUri ¶
func (*SimpleUserModel) AppidGetPlatform ¶
func (c *SimpleUserModel) AppidGetPlatform(appid string) *pipe.AccountPlatform
func (*SimpleUserModel) ChangePassword ¶
func (c *SimpleUserModel) ChangePassword(useValid bool) iris.Handler
func (*SimpleUserModel) FuzzGetUser ¶
func (c *SimpleUserModel) FuzzGetUser(ctx context.Context, idOrName string) (*SimpleUserModel, error)
func (*SimpleUserModel) GenJwtToken ¶
func (*SimpleUserModel) GetCollName ¶
func (c *SimpleUserModel) GetCollName() string
func (*SimpleUserModel) GetRbac ¶
func (c *SimpleUserModel) GetRbac() *pipe.RbacDomain
func (*SimpleUserModel) GetUid ¶
func (c *SimpleUserModel) GetUid() string
func (*SimpleUserModel) GetUserItem ¶
func (c *SimpleUserModel) GetUserItem(ctx context.Context, filter bson.M) (*SimpleUserModel, error)
func (*SimpleUserModel) LoginUseEmailHandler ¶
func (c *SimpleUserModel) LoginUseEmailHandler(useValid bool) iris.Handler
func (*SimpleUserModel) LoginUseUserNameHandler ¶
func (c *SimpleUserModel) LoginUseUserNameHandler(useValid bool) iris.Handler
func (*SimpleUserModel) Masking ¶
func (c *SimpleUserModel) Masking(level int) *SimpleUserModel
Masking 数据脱敏 传入level 1隐藏号码 2隐藏余额
func (*SimpleUserModel) MustLoginMiddleware ¶
func (c *SimpleUserModel) MustLoginMiddleware() iris.Handler
func (*SimpleUserModel) OpLog ¶
func (c *SimpleUserModel) OpLog() *qmgo.Collection
func (*SimpleUserModel) OpenIdGetPlatform ¶
func (c *SimpleUserModel) OpenIdGetPlatform(openid string) *pipe.AccountPlatform
func (*SimpleUserModel) PlatformIsExist ¶
func (c *SimpleUserModel) PlatformIsExist(name string) bool
func (*SimpleUserModel) RegistryUseUserNameHandler ¶
func (c *SimpleUserModel) RegistryUseUserNameHandler(useValid bool) iris.Handler
func (*SimpleUserModel) RemoveUser ¶
func (c *SimpleUserModel) RemoveUser(ctx context.Context, uid string) error
func (*SimpleUserModel) RoleSecret ¶
func (c *SimpleUserModel) RoleSecret() string
func (*SimpleUserModel) RoleSetHandler ¶
func (c *SimpleUserModel) RoleSetHandler() iris.Handler
func (*SimpleUserModel) SetHooks ¶
func (c *SimpleUserModel) SetHooks(hooks *SimpleUserHooks)
func (*SimpleUserModel) SetRoleSecret ¶
func (c *SimpleUserModel) SetRoleSecret(roleSecret string)
func (*SimpleUserModel) SetRoleUseEmail ¶
func (*SimpleUserModel) SetRoleUsePhone ¶
func (*SimpleUserModel) SetRoleUseUid ¶
func (*SimpleUserModel) SetRoleUseUserName ¶
type UserChangePasswordReq ¶
type UserChangePasswordReq struct {
OldPassword string `json:"old_password,omitempty" comment:"旧密码" validate:"required,min=6,max=36"`
Password string `json:"password,omitempty" comment:"新密码" validate:"required,min=6,max=36"`
ValidId string `json:"valid_id,omitempty" comment:"验证码id"`
ValidValue string `json:"valid_value,omitempty" comment:"验证码值"`
}
type UserPasswordLoginReq ¶
type UserPasswordLoginReq struct {
UserName string `json:"user_name,omitempty" comment:"用户名" validate:"required,min=3,max=24"`
Password string `json:"password,omitempty" comment:"密码" validate:"required,min=6,max=36"`
ValidId string `json:"valid_id,omitempty" comment:"验证码id"`
ValidValue string `json:"valid_value,omitempty" comment:"验证码值"`
Force bool `json:"force,omitempty" comment:"强制"`
Strict bool `json:"strict,omitempty" comment:"严苛模式"`
}
type UserRegLoginReq ¶
type UserRegLoginReq struct {
UserName string `json:"user_name,omitempty" comment:"用户名" validate:"required,min=3,max=24"`
Password string `json:"password,omitempty" comment:"密码" validate:"required,min=6,max=36"`
Invite string `json:"invite,omitempty" comment:"邀请人" validate:"omitempty,max=50"`
ValidId string `json:"valid_id,omitempty" comment:"验证码id"`
ValidValue string `json:"valid_value,omitempty" comment:"验证码值"`
}
Source Files
¶
Click to show internal directories.
Click to hide internal directories.