nosql

package
v0.0.0-...-4de286f Latest Latest
Warning

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

Go to latest
Published: Oct 22, 2019 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Logger = addition.Logger

Logger logger

View Source
var MGOExt = addition.MGOExt

MGOExt mgo ext

Functions

func RegisterRole

func RegisterRole(r *gin.RouterGroup)

RegisterRole inject function

func RegisterUser

func RegisterUser(r *gin.RouterGroup, role *role.Role)

RegisterUser inject function

Types

type File

type File struct {
	Model  `bson:",inline"`
	UID    string      `bson:"uid" br:"comment:'标识'"`
	Name   string      `bson:"name" br:"comment:'名称'"`
	Type   string      `bson:"type" br:"comment:'类型'"`
	Status uint        `bson:"status" br:"comment:'状态'"`
	Size   uint        `bson:"size" br:"comment:'大小'"`
	URL    string      `bson:"url" br:"comment:'URL'"`
	Path   null.String `bson:"path" br:"comment:'路径'"`
}

File defined struct

type Model

type Model struct {
	ID        bson.ObjectId `bson:"_id,omitempty" br:"comment:'模型ID'"`
	CreatorID bson.ObjectId `bson:"_creator,omitempty" br:"comment:'创建人ID'"`
	Creator   *User         `bson:"creator,omitempty" br:"ref(users,_creator,_id),comment:'创建人',up(password)"`
	CreatedAt *time.Time    `bson:"_created" br:"comment:'创建时间'"`

	UpdatorID bson.ObjectId `bson:"_updator,omitempty" br:"comment:'修改人ID'"`
	Updator   *User         `bson:"modifier,omitempty" br:"ref(users,_updator,_id),comment:'修改人',up(password)"`
	UpdatedAt *time.Time    `bson:"_updated" br:"comment:'修改时间'"`

	DeleterID bson.ObjectId `bson:"_deleter,omitempty" br:"comment:'删除人ID'"`
	Deleter   *User         `bson:"deleter,omitempty"  br:"ref(users,_deleter,_id),comment:'删除人',up(password)"`
	DeletedAt *time.Time    `bson:"_deleted" br:"comment:'删除时间'"`
}

Model common fields

func DefaultModel

func DefaultModel() Model

DefaultModel defined DefaultModel

type Param

type Param struct {
	Model `bson:",inline"`
	Code  string  `bson:"code" br:"comment:'编码'"`
	Name  string  `bson:"name" br:"comment:'名称'"`
	Value []Value `bson:"value" br:"comment:'属性值'"`
}

Param defined struct

func (*Param) AddEnum

func (p *Param) AddEnum(model string, key string, value []Value) *Param

AddEnum defined add enum type

type Permission

type Permission struct {
	Model       `bson:",inline"`
	Code        string        `bson:"code" br:"comment:'编码'"`
	Name        string        `bson:"name" br:"comment:'名称'"`
	Pid         bson.ObjectId `bson:"pid,omitempty" br:"comment:'父级ID'"`
	PPermission *Permission   `bson:"ppermission,omitempty" br:"ref(permission,pid,_id)'"`
	Type        uint          `bson:"type" br:"comment:'类型',enum:'一级菜单=101 二级菜单=102 三级菜单=103 按钮=104 自定义=105'"`
}

Permission info

type Role

type Role struct {
	Model         `bson:",inline"`
	Name          string          `bson:"name" br:"comment:'名称'"`
	Code          string          `bson:"code" br:"comment:'编码'"`
	Type          string          `bson:"type" br:"comment:'类别', enum:'管理=101 业务=102'"`
	PermissionIDs []bson.ObjectId `bson:"permission_ids" br:"comment:'权限ID'"`
	Permissions   *[]Permission   `bson:"permissions,omitempty" br:"ref(permission,permission_ids,_id)'"`
}

Role info

type User

type User struct {
	Model    `bson:",inline"`
	Name     string          `bson:"name" br:"comment:'名称'"`
	Password string          `bson:"password" br:"comment:'密码'"`
	Salt     string          `bson:"salt" br:"comment:'盐噪点s'"`
	Age      uint            `bson:"age" br:"comment:'年龄'"`
	RoleIds  []bson.ObjectId `bson:"role_ids" br:"comment:'角色列表'"`
	Roles    *[]Role         `bson:"roles,omitempty" br:"ref(role,role_ids,_id)'"`
}

User info

func (*User) SetPassword

func (u *User) SetPassword(password string)

SetPassword Method to set salt and hash the password for a user

func (*User) ValidPassword

func (u *User) ValidPassword(password string) bool

ValidPassword Method to check the entered password is correct or not

type Value

type Value struct {
	Category    string `bson:"category" br:"comment:'类别'"`
	SubCategory string `bson:"subcategory" br:"comment:'子类别'"`
	Key         string `bson:"key" br:"comment:'属性'"`
	Value       string `bson:"value" br:"comment:'属性值'"`
}

Value defined struct

Jump to

Keyboard shortcuts

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