mysql

package
v0.0.0-...-a14fa2b Latest Latest
Warning

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

Go to latest
Published: Oct 23, 2020 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddRelation

func AddRelation(db *sql.DB, aid, rid uint32) error

AddRelation add an relation

func AddURLPermission

func AddURLPermission(db *sql.DB, rid uint32, url string) error

AddURLPermission -

func AdminGetRoleMap

func AdminGetRoleMap(db *sql.DB, aid uint64) (map[uint32]bool, error)

AdminGetRoleMap list all the roles of the specified admin and the return form is map.

func CreateRole

func CreateRole(db *sql.DB, name, intro *string) error

CreateRole create a new role information.

func CreateTable

func CreateTable(db *sql.DB) error

CreateTable create role table.

func GetAdminIDMap

func GetAdminIDMap(db *sql.DB) (map[uint32]bool, error)

GetAdminIDMap list all the roles of the specified admin and the return form is map.

func GetRoleIDMap

func GetRoleIDMap(db *sql.DB) (map[uint32]bool, error)

GetRoleIDMap list all the roles of the specified admin and the return form is map.

func IsActive

func IsActive(db *sql.DB, id uint32) (bool, error)

IsActive return Active and nil if query success.

func ModifyRole

func ModifyRole(db *sql.DB, id uint32, name, intro *string) error

ModifyRole modify role information.

func ModifyRoleActive

func ModifyRoleActive(db *sql.DB, id uint32, active bool) error

ModifyRoleActive modify role active.

func Permissions

func Permissions(db *sql.DB) (*[]*Permission, error)

Permissions lists all the roles.

func RemoveRelation

func RemoveRelation(db *sql.DB, aid, rid uint32) error

RemoveRelation delate an relation

func RemoveURLPermission

func RemoveURLPermission(db *sql.DB, rid uint32, url string) error

RemoveURLPermission -

func URLPermissions

func URLPermissions(db *sql.DB, url *string) (map[uint32]bool, error)

URLPermissions lists all the roles of the specified URL.

Types

type Permission

type Permission struct {
	URL       string
	RoleID    uint32
	CreatedAt string
}

Permission -

type RelationData

type RelationData struct {
	AdminID uint32
	RoleID  uint32
}

RelationData -

func AssociatedRoleList

func AssociatedRoleList(db *sql.DB, aid uint32) ([]*RelationData, error)

AssociatedRoleList list all the roles of the specified admin and the return form is slice.

type Role

type Role struct {
	RoleID   uint32
	Name     string
	Intro    string
	Active   bool
	CreateAt string
}

Role -

func GetRoleByID

func GetRoleByID(db *sql.DB, id uint32) (*Role, error)

GetRoleByID get role by id.

func RoleList

func RoleList(db *sql.DB) ([]*Role, error)

RoleList get all role information.

Jump to

Keyboard shortcuts

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