models

package
v0.0.0-...-3735443 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 13, 2023 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func TransSetUpdate

func TransSetUpdate(data metadata.MapStr) *bson.D

Types

type Account

type Account struct {
	BaseModel   `json:",inline" bson:",inline"`
	Username    string `json:"username" bson:"username"`
	Nickname    string `json:"nickname" bson:"nickname"`
	Password    string `json:"password" bson:"password"`
	Email       string `json:"email" bson:"email"`
	Enabled     bool   `json:"enable" bson:"enable"`
	IsSuperuser bool   `json:"is_superuser" bson:"is_supersor"`
	IsAdmin     bool   `json:"is_admin" bson:"is_admin"`
}

func AccountManager

func AccountManager() *Account

func (*Account) ChangePassword

func (a *Account) ChangePassword(ctx context.Context, cipher string) error

func (*Account) Create

func (a *Account) Create(ctx context.Context) error

func (*Account) Delete

func (a *Account) Delete(ctx context.Context, cond *metadata.Condition) error

func (*Account) GetInfo

func (a *Account) GetInfo(ctx context.Context, cond *metadata.Condition) (*AccountInfo, error)

func (*Account) GetInfoById

func (a *Account) GetInfoById(ctx context.Context, id int64) (*AccountInfo, error)

func (*Account) GetInfoByUsername

func (a *Account) GetInfoByUsername(ctx context.Context, username string) (*AccountInfo, error)

func (*Account) GetList

func (a *Account) GetList(ctx context.Context, cond *metadata.Condition) ([]Account, error)

func (*Account) GetPageList

func (a *Account) GetPageList(ctx context.Context, cond *metadata.Condition) (*metadata.PageData, error)

func (*Account) SearchByName

func (a *Account) SearchByName(ctx context.Context, username string) error

func (*Account) Update

func (a *Account) Update(ctx context.Context, data metadata.MapStr) error

type AccountInfo

type AccountInfo struct {
	*Account `json:",inline"`
	Roles    []string               `json:"roles"`
	Actions  []PrivilegeActionModel `json:"actions"`
}

type BaseModel

type BaseModel struct {
	Id         int64            `json:"id" bson:"id"`
	CreateTime metadata.DpmTime `json:"createTime" bson:"createTime"`
	UpdateTime metadata.DpmTime `json:"updateTime" bson:"updateTime"`
}

func (*BaseModel) ToMap

func (b *BaseModel) ToMap() metadata.MapStr

type PrivilegeActionModel

type PrivilegeActionModel struct {
	BaseModel    `json:",inline" bson:",inline"`
	Name         string `json:"name" bson:"name"`
	Desc         string `json:"desc" bson:"desc"`
	CateEn       string `json:"cate_en" bson:"cate_en"`             // 类别英文描述
	CateCh       string `json:"cate_ch" bson:"cate_ch"`             // 类别中文描述
	NeedResource bool   `json:"need_resource" bson:"need_resource"` // 是否需要资源绑定
	Method       string `json:"method" bson:"method"`               // http 方法
	Url          string `json:"url" bson:"url"`                     // 接口url
}

权限动作模型

func (*PrivilegeActionModel) Update

func (pa *PrivilegeActionModel) Update(ctx context.Context, actions []metadata.MapStr) error

type PrivilegeRecordModel

type PrivilegeRecordModel struct {
	BaseModel  `json:",inline" bson:",inline"`
	ItemId     int64 `json:"itemid" bson:"itemid"`         // 记录用户或者角色的id
	ResourceId int64 `json:"resourceid" bson:"resourceid"` // 资源ID,0为所有资源
	ActionId   int64 `json:"actionid" bson:"actionid"`
}

权限记录模型

type ProjectModel

type ProjectModel struct {
	BaseModel `json:",inline" bson:",inline"`
	Name      string `json:"name" bson:"name"`
	Desc      string `json:"desc" bson:"desc"`
	Owner     string `json:"owner" bson:"owner"`
	Status    string `json:"status" bson:"status"`
}

func ProjectManager

func ProjectManager() *ProjectModel

func (*ProjectModel) Create

func (p *ProjectModel) Create(ctx context.Context) error

func (*ProjectModel) GetDetail

func (p *ProjectModel) GetDetail(ctx context.Context, cond *metadata.Condition) error

func (*ProjectModel) GetList

func (p *ProjectModel) GetList(ctx context.Context, cond *metadata.Condition) ([]ProjectModel, error)

func (*ProjectModel) GetPageList

func (p *ProjectModel) GetPageList(ctx context.Context, cond *metadata.Condition) (*metadata.PageData, error)

func (*ProjectModel) Update

func (p *ProjectModel) Update(ctx context.Context, cond *metadata.Condition, data metadata.MapStr) error

type RoleModel

type RoleModel struct {
	BaseModel `json:",inline" bson:",inline"`
	Name      string `json:"name" bson:"name"`
	Desc      string `json:"desc" bson:"desc"`
}

type RolesAccountsModel

type RolesAccountsModel struct {
	BaseModel `json:",inline" bson:",inline"`
	RoleId    int64 `json:"roleid" bson:"roleid"`
	AccountId int64 `json:"accountid" bson:"accountid"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL