models

package
v0.0.0-...-17112b8 Latest Latest
Warning

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

Go to latest
Published: May 6, 2019 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddMenu

func AddMenu(data map[string]string) (int, error)

func AddRole

func AddRole(name string, data map[string][]int) (id int, err error)

func AddUser

func AddUser(data map[string]interface{}) (id int, err error)

func CheckUserUsername

func CheckUserUsername(username string) (bool, error)

func CloseDB

func CloseDB()

func DeleteMenu

func DeleteMenu(mid int) error

func DeleteRole

func DeleteRole(rid int) error

func DeleteUser

func DeleteUser(uid int) error

func EditUser

func EditUser(uid int, data map[string][]int) error

func ExistUserById

func ExistUserById(id int) (bool, error)

func ExistsMenu

func ExistsMenu(name string) (bool, error)

func ExistsMenuById

func ExistsMenuById(id int) (bool, error)

func ExistsRole

func ExistsRole(ro string) (bool, error)

func ExistsRoleByID

func ExistsRoleByID(rid int) (bool, error)

func GetMenuTotal

func GetMenuTotal(maps map[string]interface{}) (id int, err error)

func GetRoleTotal

func GetRoleTotal(data interface{}) (int, error)

func GetUserTotal

func GetUserTotal(maps interface{}) (int, error)

func MigrateUsers

func MigrateUsers() error

func Setup

func Setup()

func UpdateMenu

func UpdateMenu(data map[string]interface{}) error

func UpdateRole

func UpdateRole(rid int, data map[string][]int) (id int, err error)

func UpdateUswePassword

func UpdateUswePassword(id int, password string) error

Types

type Menu struct {
	Model
	Name   string `json:"name"`
	Path   string `json:"path"`
	Method string `json:"method"`
}

func GetMenus

func GetMenus(PageNum, PageSize int, maps interface{}) ([]*Menu, error)

type Model

type Model struct {
	ID         int `gorm:"primary_key" json:"id"`
	CreatedOn  int `json:"created_on"`
	ModifiedOn int `json:"modified_on"`
	DeletedOn  int `json:"deleted_on"`
}

type Role

type Role struct {
	Model
	Name string `json:"name"`
	Menu []Menu `json:"menu" gorm:"many2many:role_menu;"`
}

func GetRole

func GetRole(id int) (*Role, error)

func GetRoles

func GetRoles(pageNum, pageSize int, data interface{}) ([]*Role, error)

func GetRolesAll

func GetRolesAll() ([]*Role, error)

type User

type User struct {
	Model
	Username string `json:"username"`
	Password string `json:"password"`
	Role     []Role `json:"role" gorm:"many2many:user_role;"`
}

func CheckUser

func CheckUser(username, password string) (*User, error)

func GetUser

func GetUser(id int) (*User, error)

func GetUsers

func GetUsers(PageNum, PageSize int, maps interface{}) ([]*User, error)

func GetUsersAll

func GetUsersAll() ([]*User, error)

Jump to

Keyboard shortcuts

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