models

package
v0.0.0-...-ae94dc8 Latest Latest
Warning

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

Go to latest
Published: Jan 22, 2019 License: LGPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateRelationRoleMenu

func CreateRelationRoleMenu(roleMenu ...*RoleMenu) (int64, error)

func CreateUser

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

func DeleteByRoles

func DeleteByRoles(rids []int64) (effect int64, err error)

func DeleteByUsers

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

func GetUserByUsername

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

func UpdateRoleById

func UpdateRoleById(role *CasbinRule) (int64, error)

func UpdateUserById

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

Types

type CasbinRule

type CasbinRule struct {
	Id    int64  `xorm:"pk autoincr INT(10) notnull" json:"id" form:"id"`
	PType string `xorm:"varchar(100) index" json:"p_type"`
	V0    string `xorm:"varchar(100) index" json:"v0"`
	V1    string `xorm:"varchar(100) index" json:"v1"`
	V2    string `xorm:"varchar(100) index" json:"v2"`
	V3    string `xorm:"varchar(100) index" json:"v3"`
	V4    string `xorm:"varchar(100) index" json:"v4"`
	V5    string `xorm:"varchar(100) index" json:"v5"`
}

func GetPaginationRoles

func GetPaginationRoles(page *supports.Pagination) ([]*CasbinRule, int64, error)

type Children

type Children struct {
	Id2          int64  `xorm:"pk autoincr INT(10) notnull" json:"id"`
	Path2        string `xorm:"varchar(64) notnull" json:"path"`
	Modular2     string `xorm:"varchar(64) notnull" json:"modular"`
	Component2   string `xorm:"varchar(64) notnull" json:"component"`
	Name2        string `xorm:"varchar(64) notnull" json:"name"`
	Icon2        string `xorm:"varchar(64) notnull" json:"icon"`
	KeepAlive2   string `xorm:"varchar(64) notnull" json:"keep_alive"`
	RequireAuth2 string `xorm:"varchar(64) notnull" json:"require_auth"`
	ParentId2    string `xorm:"INT(10) notnull" json:"parent_id"`
	Enabled2     string `xorm:"tinyint(1) notnull" json:"enabled"`
}

子菜单

type Demo

type Demo struct {
	Pid         int64     `xorm:"pk autoincr INT(10) notnull" json:"pid"`
	ProductCode string    `xorm:"notnull" json:"productCode"`
	ProductName string    `xorm:"notnull" json:"productName"`
	Number      int       `xorm:"notnull" json:"number"`
	CreateDate  time.Time `xorm:"notnull" json:"createDate"`
}
type Menu struct {
	Id          int64     `xorm:"pk autoincr INT(10) notnull" json:"id"`
	Path        string    `xorm:"varchar(64) notnull" json:"path"`
	Url         string    `xorm:"varchar(64) notnull" json:"url"`
	Modular     string    `xorm:"varchar(64) notnull" json:"modular"`
	Component   string    `xorm:"varchar(64) notnull" json:"component"`
	Name        string    `xorm:"varchar(64) notnull" json:"name"`
	Icon        string    `xorm:"varchar(64) notnull" json:"icon"`
	KeepAlive   string    `xorm:"varchar(64) notnull" json:"keep_alive"`
	RequireAuth string    `xorm:"varchar(64) notnull" json:"require_auth"`
	ParentId    string    `xorm:"INT(10) notnull" json:"parent_id"`
	Enabled     string    `xorm:"tinyint(1) notnull" json:"enabled"`
	CreateTime  time.Time `json:"createTime"`
	UpdateTime  time.Time `json:"updateTime"`

	Children []Children `xorm:"-" json:"children"`
}

菜单表

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)
type MenuTreeGroup struct {
	Menu     `xorm:"extends"`
	Children `xorm:"extends"`
}

菜单树

type RoleMenu

type RoleMenu struct {
	Id  int64 `xorm:"pk autoincr INT(10) notnull" json:"id"`
	Rid int64 `xorm:"pk autoincr INT(10) notnull" json:"rid"`
	Mid int64 `xorm:"pk autoincr INT(10) notnull" json:"mid"`
}

角色-菜单关联表

type User

type User struct {
	Id         int64     `xorm:"pk autoincr INT(10) notnull" json:"id" form:"id"`
	Username   string    `xorm:"notnull" json:"username" form:"username"`
	Password   string    `xorm:"notnull" json:"password" form:"password"`
	Enable     int       `xorm:"notnull tinyint(1)" json:"enable" form:"enable"`
	Appid      string    `xorm:"notnull" json:"appid" form:"appid"`
	Name       string    `xorm:"notnull" json:"name" form:"name"`
	Phone      string    `xorm:"notnull" json:"phone" form:"phone"`
	Email      string    `xorm:"notnull" json:"email" form:"email"`
	Userface   string    `xorm:"notnull" json:"userface" form:"userface"`
	CreateTime time.Time `json:"createTime" form:"createTime"`
	UpdateTime time.Time `json:"updateTime" form:"updateTime"`
}

mysql user table

func GetPaginationUsers

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

func GetUsersByUids

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

Jump to

Keyboard shortcuts

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