Documentation ¶
Index ¶
- func GenerateHashedPassword(userPassword string) (string, error)
- func GeneratePassword(userPassword string) ([]byte, error)
- func GetRBACModels() []interface{}
- func InsertRecords(records []interface{}) (int64, error)
- type AccessLog
- func (m *AccessLog) Count() (int64, error)
- func (m *AccessLog) Delete() (int64, error)
- func (m *AccessLog) Exists() (bool, error)
- func (m *AccessLog) Fetch() (bool, error)
- func (m *AccessLog) GetID() int64
- func (m *AccessLog) InsertMany(records []interface{}) (int64, error)
- func (m *AccessLog) LoadFromEvent(event events.Event)
- func (m *AccessLog) NewRecord() AccessLogModel
- func (m *AccessLog) Save() (bool, error)
- func (m *AccessLog) TableName() string
- type AccessLogModel
- type AsyncRecordSaver
- type Module
- func (m *Module) Count() (int64, error)
- func (m *Module) Delete() (int64, error)
- func (m *Module) Exists() (bool, error)
- func (m *Module) Fetch() (bool, error)
- func (m *Module) GetKey() interface{}
- func (m *Module) GetTitle() string
- func (m *Module) InsertMany(records []interface{}) (int64, error)
- func (m *Module) IsValid() bool
- func (m *Module) Save() (bool, error)
- func (m *Module) SetChildren(children []parameters.TreeDataInterface)
- func (m *Module) TableName() string
- type NameInfo
- type Oauths
- func (m *Oauths) Count() (int64, error)
- func (m *Oauths) Delete() (int64, error)
- func (m *Oauths) Exists() (bool, error)
- func (m *Oauths) Fetch() (bool, error)
- func (m *Oauths) GetID() int64
- func (m *Oauths) InsertMany(records []interface{}) (int64, error)
- func (m *Oauths) IsValid() bool
- func (m *Oauths) Save() (bool, error)
- func (m *Oauths) TableName() string
- type OperationLog
- func (m *OperationLog) Count() (int64, error)
- func (m *OperationLog) Delete() (int64, error)
- func (m *OperationLog) Exists() (bool, error)
- func (m *OperationLog) Fetch() (bool, error)
- func (m *OperationLog) GetID() int64
- func (m *OperationLog) InsertMany(records []interface{}) (int64, error)
- func (m *OperationLog) LoadFromEvent(event events.Event)
- func (m *OperationLog) NewRecord() OperationLogModel
- func (m *OperationLog) Save() (bool, error)
- func (m *OperationLog) TableName() string
- type OperationLogModel
- type RecordModel
- type Role
- func (m *Role) Count() (int64, error)
- func (m *Role) Delete() (int64, error)
- func (m *Role) Exists() (bool, error)
- func (m *Role) Fetch() (bool, error)
- func (m *Role) GetID() int64
- func (m *Role) InsertMany(records []interface{}) (int64, error)
- func (m *Role) IsValid() bool
- func (m *Role) Save() (bool, error)
- func (m *Role) TableName() string
- type RoleModuleRelation
- func (m *RoleModuleRelation) Count() (int64, error)
- func (m *RoleModuleRelation) Delete() (int64, error)
- func (m *RoleModuleRelation) Exists() (bool, error)
- func (m *RoleModuleRelation) Fetch() (bool, error)
- func (m *RoleModuleRelation) InsertMany(records []interface{}) (int64, error)
- func (m *RoleModuleRelation) IsValid() bool
- func (m *RoleModuleRelation) Save() (bool, error)
- func (m *RoleModuleRelation) TableName() string
- type User
- func (m *User) Count() (int64, error)
- func (m *User) Delete() (int64, error)
- func (m *User) Exists() (bool, error)
- func (m *User) Fetch() (bool, error)
- func (m *User) FindByName(name string) (UserModel, error)
- func (m *User) GetID() int64
- func (m *User) GetName() string
- func (m *User) GetPasswordHash() []byte
- func (m *User) GetUserID() string
- func (m *User) InsertMany(records []interface{}) (int64, error)
- func (m *User) IsValid() bool
- func (m *User) NewRecord(name string, passwordHash []byte) UserModel
- func (m *User) Save() (bool, error)
- func (m *User) SetName(name string)
- func (m *User) SetPasswordHash(passwdHash []byte)
- func (m *User) SetUserID(id string) error
- func (m *User) TableName() string
- func (m *User) VerifyPassword(passwordOrHash string) bool
- type UserModel
- type UserRoleRelation
- func (m *UserRoleRelation) Count() (int64, error)
- func (m *UserRoleRelation) Delete() (int64, error)
- func (m *UserRoleRelation) Exists() (bool, error)
- func (m *UserRoleRelation) Fetch() (bool, error)
- func (m *UserRoleRelation) InsertMany(records []interface{}) (int64, error)
- func (m *UserRoleRelation) IsValid() bool
- func (m *UserRoleRelation) Save() (bool, error)
- func (m *UserRoleRelation) TableName() string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GenerateHashedPassword ¶
GenerateHashedPassword 将根据输入密码生成哈希密码 用户的输入
func GeneratePassword ¶
GeneratePassword 将根据输入密码生成哈希密码 用户的输入
Types ¶
type AccessLog ¶
type AccessLog struct { ID int64 `xorm:"'id' BigInt pk autoincr" json:"id"` AppID string `xorm:"'app_id' VARCHAR(42) index" json:"appId"` // 应用标识 Module string `xorm:"'module' VARCHAR(64) notnull index" json:"module"` // 模块分组 Name string `xorm:"'name' VARCHAR(64) notnull index" json:"name"` // 模块功能名称 UserID string `xorm:"'user_id' VARCHAR(64) index" json:"userId"` // 用户ID RequestID string `xorm:"'request_id' VARCHAR(64) index" json:"requestId"` // 请求唯一标识 CorrelationID string `xorm:"'correlation_id' VARCHAR(64) index" json:"currelationId"` // 调用链唯一标识 DeviceID string `xorm:"'device_id' VARCHAR(64) index" json:"deviceId"` // 设备标识 RemoteIP string `xorm:"'remote_ip' VARCHAR(64) index" json:"remoteIp"` // 源IP Agent string `xorm:"'agent' VARCHAR(128)" json:"agent"` // 源客户端信息 Markup string `xorm:"'markup' VARCHAR(128)" json:"markup"` // 访问界面元素标记 Status int `xorm:"'status' Int index" json:"status"` // 响应状态 Message string `xorm:"'message' TEXT" json:"message"` // 响应提示 Timestamp int64 `xorm:"'timestamp' BigInt index comment('Timestamp of event occorred')" json:"timestamp"` // 事件时间戳 behaviors.ModifyingBehavior `xorm:"extends"` rdbms.Datasource `xorm:"-" datasource:"default"` }
AccessLog label element
func (*AccessLog) InsertMany ¶
InsertMany records
func (*AccessLog) LoadFromEvent ¶
LoadFromEvent load record fields by event data
func (*AccessLog) NewRecord ¶
func (m *AccessLog) NewRecord() AccessLogModel
NewRecord of access log model
type AccessLogModel ¶
type AccessLogModel interface { Save() (bool, error) LoadFromEvent(events.Event) NewRecord() AccessLogModel }
AccessLogModel interface
type AsyncRecordSaver ¶
type AsyncRecordSaver struct {
// contains filtered or unexported fields
}
AsyncRecordSaver struct
func GetAsyncRecordSaver ¶
func GetAsyncRecordSaver() *AsyncRecordSaver
GetAsyncRecordSaver AsyncRecordSaver
type Module ¶
type Module struct { ID int64 `xorm:"'id' BigInt pk autoincr" json:"id" form:"id"` Code string `xorm:"'code' VARCHAR(45) notnull index" json:"code" form:"code"` Name string `xorm:"'name' VARCHAR(64) notnull index" json:"name" form:"name"` Path string `xorm:"'path' VARCHAR(128) notnull index" json:"path" form:"path"` SystemID string `xorm:"'system_id' VARCHAR(45) null index" json:"system_id" form:"system_id"` ParentID int64 `xorm:"'parent_id' BigInt index" json:"parent_id" form:"parent_id"` Icon string `xorm:"'icon' VARCHAR(45) null" json:"icon" form:"icon"` ViewOrder int `xorm:"'view_order' Int default(1)" json:"view_order" form:"view_order"` Flag int `xorm:"'flag' Int index" json:"flag" form:"flag"` Remark string `xorm:"'remark' VARCHAR(255) null" json:"remark" form:"remark"` behaviors.ModifyingBehavior `xorm:"extends"` rdbms.Datasource `xorm:"-" datasource:"default"` Children []parameters.TreeDataInterface `xorm:"-" json:"children" form:"-"` }
Module 内置RBAC-模块模型。
func FindAuthorizedModules ¶
FindAuthorizedModules by user id
func (*Module) InsertMany ¶
InsertMany records
func (*Module) SetChildren ¶
func (m *Module) SetChildren(children []parameters.TreeDataInterface)
SetChildren interface of tree node data
type NameInfo ¶
type NameInfo struct { ID interface{} `json:"id" xorm:"'id'"` Name string `json:"name" xorm:"'name' VARCHAR"` }
type Oauths ¶
type Oauths struct { ID int64 `xorm:"'id' BigInt pk autoincr" json:"id" form:"id"` UserID int64 `xorm:"'user_id' BigInt index" json:"user_id" form:"user_id"` OauthType string `xorm:"'oauth_type' VARCHAR(64) notnull index" json:"oauth_type" form:"oauth_type"` OauthID string `xorm:"'oauth_id' VARCHAR(64) null index" json:"oauth_id" form:"oauth_id"` UnionID string `xorm:"'union_id' VARCHAR(64) null index" json:"union_id" form:"union_id"` Credential string `xorm:"'credential' VARCHAR(64) null" json:"credential" form:"credential"` behaviors.ModifyingBehavior `xorm:"extends"` rdbms.Datasource `xorm:"-" datasource:"default"` }
Oauths 内置第三方登录授权模型。
func (*Oauths) InsertMany ¶
InsertMany records
type OperationLog ¶
type OperationLog struct { ID int64 `xorm:"'id' BigInt pk autoincr" json:"id"` AppID string `xorm:"'app_id' VARCHAR(42) index" json:"appId"` // 应用标识 Module string `xorm:"'module' VARCHAR(64) notnull index" json:"module"` // 模块分组 Name string `xorm:"'name' VARCHAR(64) notnull index" json:"name"` // 模块功能名称 UserID string `xorm:"'user_id' VARCHAR(64) index" json:"userId"` // 用户ID RequestID string `xorm:"'request_id' VARCHAR(64) index" json:"requestId"` // 请求唯一标识 CorrelationID string `xorm:"'correlation_id' VARCHAR(64) index" json:"currelationId"` // 调用链唯一标识 DeviceID string `xorm:"'device_id' VARCHAR(64) index" json:"deviceId"` // 设备标识 RemoteIP string `xorm:"'remote_ip' VARCHAR(64) index" json:"remoteIp"` // 源IP Agent string `xorm:"'agent' VARCHAR(128)" json:"agent"` // 源客户端信息 Status int `xorm:"'status' Int index" json:"status"` // 响应状态 Message string `xorm:"'message' TEXT" json:"message"` // 响应提示 Timestamp int64 `xorm:"'timestamp' BigInt index comment('Timestamp of event occorred')" json:"timestamp"` // 事件时间戳 behaviors.ModifyingBehavior `xorm:"extends"` rdbms.Datasource `xorm:"-" datasource:"default"` }
OperationLog label element
func (*OperationLog) Fetch ¶
func (m *OperationLog) Fetch() (bool, error)
Fetch retrieve one record by self condition
func (*OperationLog) InsertMany ¶
func (m *OperationLog) InsertMany(records []interface{}) (int64, error)
InsertMany records
func (*OperationLog) LoadFromEvent ¶
func (m *OperationLog) LoadFromEvent(event events.Event)
LoadFromEvent load record fields by event data
func (*OperationLog) NewRecord ¶
func (m *OperationLog) NewRecord() OperationLogModel
NewRecord of access log model
type OperationLogModel ¶
type OperationLogModel interface { Save() (bool, error) LoadFromEvent(events.Event) NewRecord() OperationLogModel }
OperationLogModel interface
type Role ¶
type Role struct { ID int64 `xorm:"'id' BigInt pk autoincr" json:"id" form:"id"` Name string `xorm:"'name' VARCHAR(64) notnull index" json:"name" form:"name"` Code string `xorm:"'code' VARCHAR(45) notnull index" json:"code" form:"code"` AppID string `xorm:"'app_id' VARCHAR(45) null index" json:"app_id" form:"app_id"` SystemID string `xorm:"'system_id' VARCHAR(45) null index" json:"system_id" form:"system_id"` Avatar string `xorm:"'avatar' VARCHAR(64) null" json:"avatar" form:"avatar"` Remark string `xorm:"'remark' VARCHAR(255) null" json:"remark" form:"remark"` behaviors.ModifyingBehavior `xorm:"extends"` rdbms.Datasource `xorm:"-" datasource:"default"` Modules []NameInfo `xorm:"-" json:"modules"` }
Role 内置RBAC-角色模型。
func (*Role) InsertMany ¶
InsertMany records
type RoleModuleRelation ¶
type RoleModuleRelation struct { ID int64 `xorm:"'id' BigInt pk autoincr" json:"id" form:"id"` ModuleID int64 `xorm:"'module_id' BigInt notnull index unique(uniq_role_module_idx)" json:"module_id" form:"module_id"` RoleID int64 `xorm:"'role_id' BigInt notnull index unique(uniq_role_module_idx)" json:"role_id" form:"role_id"` SystemID string `xorm:"'system_id' VARCHAR(45) null index" json:"system_id" form:"system_id"` behaviors.ModifyingBehavior `xorm:"extends"` rdbms.Datasource `xorm:"-" datasource:"default"` }
RoleModuleRelation 内置RBAC-角色与被授权模块关联图模型。
func (*RoleModuleRelation) Delete ¶
func (m *RoleModuleRelation) Delete() (int64, error)
Delete record
func (*RoleModuleRelation) Exists ¶
func (m *RoleModuleRelation) Exists() (bool, error)
Exists by record
func (*RoleModuleRelation) Fetch ¶
func (m *RoleModuleRelation) Fetch() (bool, error)
Fetch retrieve one record by self condition
func (*RoleModuleRelation) InsertMany ¶
func (m *RoleModuleRelation) InsertMany(records []interface{}) (int64, error)
InsertMany records
func (*RoleModuleRelation) IsValid ¶
func (m *RoleModuleRelation) IsValid() bool
IsValid 可以做一些非常简单的“低级”数据验证
func (*RoleModuleRelation) Save ¶
func (m *RoleModuleRelation) Save() (bool, error)
Save record to database
func (*RoleModuleRelation) TableName ¶
func (m *RoleModuleRelation) TableName() string
TableName table name
type User ¶
type User struct { ID int64 `xorm:"'id' BigInt pk autoincr" json:"id" form:"id"` Name string `xorm:"'name' VARCHAR(64) notnull index" json:"name" form:"name"` Telephone string `xorm:"'telephone' VARCHAR(64) null index" json:"telephone" form:"telephone"` Email string `xorm:"'email' VARCHAR(64) null index" json:"email" form:"email"` Avatar string `xorm:"'avatar' VARCHAR(64) null index" json:"avatar" form:"avatar"` HashedPassword string `xorm:"'passwd_hash' VARCHAR(64)" json:"-" form:"-"` behaviors.ModifyingBehavior `xorm:"extends"` rdbms.Datasource `xorm:"-" datasource:"default"` Roles []NameInfo `xorm:"-" json:"roles"` }
User 内置用户模型
func (*User) FindByName ¶
FindByName of user model
func (*User) GetPasswordHash ¶
GetPasswordHash user password
func (*User) InsertMany ¶
InsertMany records
func (*User) SetPasswordHash ¶
SetPasswordHash user password
func (*User) VerifyPassword ¶
VerifyPassword to user password
type UserModel ¶
type UserModel interface { GetUserID() string SetUserID(string) error GetName() string SetName(string) GetPasswordHash() []byte SetPasswordHash([]byte) Save() (bool, error) NewRecord(name string, passwordHash []byte) UserModel FindByName(name string) (UserModel, error) VerifyPassword(passwordOrHash string) bool }
UserModel interface
type UserRoleRelation ¶
type UserRoleRelation struct { ID int64 `xorm:"'id' BigInt pk autoincr" json:"id" form:"id"` RoleID int64 `xorm:"'role_id' BigInt notnull index unique(uniq_user_role_idx)" json:"role_id" form:"role_id"` UserID int64 `xorm:"'user_id' BigInt notnull index unique(uniq_user_role_idx)" json:"user_id" form:"user_id"` SystemID string `xorm:"'system_id' VARCHAR(45) null index" json:"system_id" form:"system_id"` behaviors.ModifyingBehavior `xorm:"extends"` rdbms.Datasource `xorm:"-" datasource:"default"` }
UserRoleRelation 内置RBAC-角色与被授权模块关联图模型。
func (*UserRoleRelation) Exists ¶
func (m *UserRoleRelation) Exists() (bool, error)
Exists by record
func (*UserRoleRelation) Fetch ¶
func (m *UserRoleRelation) Fetch() (bool, error)
Fetch retrieve one record by self condition
func (*UserRoleRelation) InsertMany ¶
func (m *UserRoleRelation) InsertMany(records []interface{}) (int64, error)
InsertMany records
func (*UserRoleRelation) IsValid ¶
func (m *UserRoleRelation) IsValid() bool
IsValid 可以做一些非常简单的“低级”数据验证
func (*UserRoleRelation) Save ¶
func (m *UserRoleRelation) Save() (bool, error)
Save record to database
func (*UserRoleRelation) TableName ¶
func (m *UserRoleRelation) TableName() string
TableName table name