model

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

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

Go to latest
Published: Oct 31, 2019 License: GPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type API

type API struct {
	gorm.Model
	Path        string `json:"path"`
	Description string `json:"description"`
	Group       string `json:"group"`
}

API ...

func (*API) CreateAPI

func (a *API) CreateAPI() (err error)

CreateAPI ...

func (*API) DeleteAPI

func (a *API) DeleteAPI() (err error)

DeleteAPI ...

func (*API) GetAPIByID

func (a *API) GetAPIByID(id float64) (api API, err error)

GetAPIByID ...

func (*API) GetAllAPIs

func (a *API) GetAllAPIs() (apis []API, err error)

GetAllAPIs 获取所有api信息

func (*API) GetInfoList

func (a *API) GetInfoList(info modelinterface.PageInfo) (list interface{}, total int, err error)

GetInfoList 分页获取数据 需要分页实现这个接口即可

func (*API) UpdataAPI

func (a *API) UpdataAPI() (err error)

UpdataAPI ...

type APIAuthority

type APIAuthority struct {
	gorm.Model
	AuthorityID string
	Authority   Authority `gorm:"ForeignKey:AuthorityId;AssociationForeignKey:AuthorityId"` //其实没有关联的必要
	APIID       uint
	API         API
}

APIAuthority ...

func (*APIAuthority) GetAuthAndAPI

func (a *APIAuthority) GetAuthAndAPI(authID string) (apiIds []uint, err error)

GetAuthAndAPI 获取角色api关联关系

func (*APIAuthority) SetAuthAndAPI

func (a *APIAuthority) SetAuthAndAPI(authID string, apisid []uint) (err error)

SetAuthAndAPI 创建角色api关联关系

type Authority

type Authority struct {
	gorm.Model
	AuthorityID   string `json:"authorityId" gorm:"not null;unique"`
	AuthorityName string `json:"authorityName"`
}

Authority ...

func (*Authority) CreateAuthority

func (a *Authority) CreateAuthority() (authority *Authority, err error)

CreateAuthority 创建角色

func (*Authority) DeleteAuthority

func (a *Authority) DeleteAuthority() (err error)

DeleteAuthority 删除角色

func (*Authority) GetInfoList

func (a *Authority) GetInfoList(info modelinterface.PageInfo) (list interface{}, total int, err error)

GetInfoList 分页获取数据 需要分页实现这个接口即可

type BaseMenu

type BaseMenu struct {
	gorm.Model
	MenuLevel uint   `json:"-"`
	ParentID  string `json:"parentId"`
	Path      string `json:"path"`
	Name      string `json:"name"`
	Hidden    bool   `json:"hidden"`
	Component string `json:"component"`
	Meta      `json:"meta"`
	NickName  string     `json:"nickName"`
	Children  []BaseMenu `json:"children"`
}

BaseMenu ...

func (*BaseMenu) AddBaseMenu

func (b *BaseMenu) AddBaseMenu() (err error)

AddBaseMenu ...

func (*BaseMenu) DeleteBaseMenu

func (b *BaseMenu) DeleteBaseMenu(id float64) (err error)

DeleteBaseMenu ...

func (*BaseMenu) GetBaseMenuByID

func (b *BaseMenu) GetBaseMenuByID(id float64) (menu BaseMenu, err error)

GetBaseMenuByID ...

func (*BaseMenu) GetBaseMenuTree

func (b *BaseMenu) GetBaseMenuTree() (menus []BaseMenu, err error)

GetBaseMenuTree 获取基础路由树

func (*BaseMenu) GetInfoList

func (b *BaseMenu) GetInfoList(info modelinterface.PageInfo) (list interface{}, total int, err error)

GetInfoList ...

func (*BaseMenu) UpdataBaseMenu

func (b *BaseMenu) UpdataBaseMenu() (err error)

UpdataBaseMenu ...

type Menu struct {
	BaseMenu
	MenuID      string `json:"menuId"`
	AuthorityID string `json:"-"`
	Children    []Menu `json:"children"`
}

Menu 需要构建的点有点多 这里关联关系表直接把所有数据拿过来 用代码实现关联 后期实现主外键模式

func (m *Menu) AddMenuAuthority(menus []BaseMenu, authorityID string) (err error)

AddMenuAuthority 为角色增加menu树

func (m *Menu) GetMenuAuthority(authorityID string) (menus []Menu, err error)

GetMenuAuthority 查看当前角色树

func (m *Menu) GetMenuTree(authorityID string) (menus []Menu, err error)

GetMenuTree 获取动态路由树

type Meta

type Meta struct {
	Title string `json:"title"`
	Icon  string `json:"icon"`
}

Meta ...

type User

type User struct {
	gorm.Model
	UUID        uuid.UUID `json:"uuid"`
	Username    string    `json:"userName"`
	Password    string    `json:"-"`
	NickName    string    `json:"nickName" gorm:"default:'QMPlusUser'"`
	HeaderImg   string    `json:"headerImg" gorm:"default:'http://www.henrongyi.top/avatar/lufu.jpg'"`
	Authority   Authority `json:"authority" gorm:"ForeignKey:AuthorityId;AssociationForeignKey:AuthorityId"`
	AuthorityID string    `json:"-" gorm:"default:888"`
}

User ...

func (*User) ChangePassword

func (u *User) ChangePassword(newPassword string) (userInter *User, err error)

ChangePassword 修改用户密码

func (*User) GetInfoList

func (u *User) GetInfoList(info modelinterface.PageInfo) (list interface{}, total int, err error)

GetInfoList 分页获取数据 需要分页实现这个接口即可

func (*User) Login

func (u *User) Login() (userInter *User, err error)

Login 用户登录

func (*User) Regist

func (u *User) Regist() (userInter *User, err error)

Regist 注册接口model方法

func (*User) SetUserAuthority

func (u *User) SetUserAuthority(uuid uuid.UUID, AuthorityID string) (err error)

SetUserAuthority 用户更新接口

func (*User) UploadHeaderImg

func (u *User) UploadHeaderImg(uuid uuid.UUID, filePath string) (userInter *User, err error)

UploadHeaderImg 用户头像上传更新地址

Jump to

Keyboard shortcuts

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