models

package
v0.0.11-grpc-test Latest Latest
Warning

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

Go to latest
Published: May 27, 2020 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateUser

func CreateUser(user ...*UserApp) (int64, error)

func CreateUser(dbEngines *conf.DBEngines, user ...*User) (int64, error) {

func DeleteByUsers

func DeleteByUsers(uids []int64) (effect int64, err error)

func GetUserByUsername

func GetUserByUsername(user *UserApp) (bool, error)

func UpdateUserById

func UpdateUserById(user *UserApp) (int64, error)

Types

type Menu struct {
	Id         int64     `xorm:"pk autoincr INT(10) notnull" json:"id"`
	Path       string    `xorm:"varchar(64) notnull" json:"path"`
	Modular    string    `xorm:"varchar(64) notnull" json:"modular"`
	Component  string    `xorm:"varchar(64) notnull" json:"component"`
	Name       string    `xorm:"varchar(64) notnull" json:"name"`
	ParentId   int64     `xorm:"INT(10) notnull" json:"parentId"`
	IsSub      bool      `xorm:"tinyint(1) notnull" json:"isSub"`
	CreateTime time.Time `json:"createTime"`
	UpdateTime time.Time `json:"updateTime"`
	Meta       Meta      `xorm:"json" json:"meta"`
}

菜单表

func DynamicMenuTree

func DynamicMenuTree(uid int64) []*Menu

获取用户的菜单列表

func GetMenusByRoleid

func GetMenusByRoleid(rid int64, page *supports.Pagination) ([]*Menu, int64, error)

func GetPaginationMenus

func GetPaginationMenus(page *supports.Pagination) ([]*Menu, int64, error)

func GetPaginationMenus(dbEngines *conf.DBEngines, page *supports.Pagination) ([]*Menu, int64, error) {

type Meta

type Meta struct {
	// 设为true后在左侧菜单不会显示该页面选项
	HideInMenu bool `json:"hideInMenu"`
	// 设为true后如果该路由只有一个子路由,在菜单中也会显示该父级菜单
	ShowAlways bool `json:"showAlways"`
	// 设为true后页面不会缓存
	NotCache bool `json:"notCache"`
	// 可访问该页面的权限数组,当前路由设置的权限会影响子路由
	Access []string `json:"access"`
	// (default: -) 该页面在左侧菜单、面包屑和标签导航处显示的图标,如果是自定义图标,需要在图标名称前加下划线'_'
	Icon string `json:"icon"`
	// default: null 用于跳转到外部连接
	Href string `json:"href"`
	// 菜单显示的名称
	Title string `json:"title"`
}

路由可配项

type UserApp

type UserApp struct {
	UserId       int       `json:"user_id" xorm:"not null pk autoincr comment('用户id') INT(11)"`
	UserName     string    `json:"user_name" xorm:"not null comment('用户名称') VARCHAR(30)"`
	UserDesc     string    `json:"user_desc" xorm:"comment('用户描述') VARCHAR(60)"`
	Pwd          string    `json:"pwd" xorm:"comment('密码') VARCHAR(32)"`
	Name         string    `json:"name" xorm:"comment('姓名') VARCHAR(50)"`
	PhoneNo      string    `json:"phone_no" xorm:"comment('手机号码') VARCHAR(15)"`
	Email        string    `json:"email" xorm:"comment('邮件') VARCHAR(30)"`
	CreatedAt    time.Time `json:"created_at" xorm:"default 'CURRENT_TIMESTAMP' comment('创建时间') TIMESTAMP"`
	CreatePerson string    `json:"create_person" xorm:"comment('创建人') VARCHAR(30)"`
	UpdatedAt    time.Time `json:"updated_at" xorm:"default 'CURRENT_TIMESTAMP' comment('更新时间') TIMESTAMP"`
	UpdatePerson string    `json:"update_person" xorm:"comment('更新人') VARCHAR(30)"`
	Enable       int       `json:"enable" xorm:"comment('开启') TINYINT(1)"`
}

func GetPaginationUsers

func GetPaginationUsers(page *supports.Pagination) ([]*UserApp, int64, error)

func GetUsersByUids

func GetUsersByUids(uids []int64, page *supports.Pagination) ([]*UserApp, int64, error)

Jump to

Keyboard shortcuts

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