models

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Dec 24, 2019 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddMenu

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

func AddRole

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

func AddUser

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

func CheckRoleName

func CheckRoleName(name string) (bool, error)

func CheckRoleNameId

func CheckRoleNameId(name string, id int) (bool, error)

func CheckUser

func CheckUser(username, password string) (bool, error)

func CheckUserUsername

func CheckUserUsername(username string) (bool, error)

func CheckUserUsernameId

func CheckUserUsernameId(username string, id int) (bool, error)

func CleanAllMenu

func CleanAllMenu() error

func CleanAllRole

func CleanAllRole() error

func CleanAllUser

func CleanAllUser() error

func CloseDB

func CloseDB()

func DeleteMenu

func DeleteMenu(id int) error

func DeleteRole

func DeleteRole(id int) error

func DeleteUser

func DeleteUser(id int) error

func EditMenu

func EditMenu(id int, data interface{}) error

func EditMenuGetRoles

func EditMenuGetRoles(id int) []int

func EditRole

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

func EditUser

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

func ExistMenuByID

func ExistMenuByID(id int) (bool, error)

func ExistRoleByID

func ExistRoleByID(id int) (bool, error)

func ExistUserByID

func ExistUserByID(id int) (bool, error)

func GetMenuTotal

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

func GetRoleTotal

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

func GetUserTotal

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

Types

type AuthSwag added in v1.3.0

type AuthSwag struct {
	Username string `json:"username"`
	Password string `json:"password"`
}
type Menu struct {
	Model
	Name   string `json:"name"`
	Path   string `json:"path"`
	Method string `json:"method"`
}

func GetMenu

func GetMenu(id int) (*Menu, error)

func GetMenus

func GetMenus(pageNum int, 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 int, pageSize int, maps 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 GetUser

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

func GetUsers

func GetUsers(pageNum int, 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