model

package
v0.0.0-...-48145d3 Latest Latest
Warning

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

Go to latest
Published: Aug 6, 2020 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddAuth

func AddAuth(data *Auth) (int64, error)

新增用户

func AddClaims

func AddClaims(data *Claims) (int64, error)

新增用户权限

func DeleteAuth

func DeleteAuth(id string) (int64, error)

删除用户

func DeleteClaims

func DeleteClaims(id string) (int64, error)

删除用户权限

func UpdateAuth

func UpdateAuth(id string, data *Auth) (int64, error)

修改用户

func UpdateClaims

func UpdateClaims(id string, data map[string]interface{}) (int64, error)

修改用户权限

func VerifyAuth

func VerifyAuth(username, pwd string) (bool, error)

验证用户名和密码是否正确

Types

type Auth

type Auth struct {
	Id       int64  `json:"id"`
	Username string `form:"username" json:"username" binding:"required" xorm:"varchar(255) notnull index"`
	Password string `form:"password" json:"password" binding:"required" xorm:"varchar(255) not null"`
}

用户表

func GetAuth

func GetAuth() ([]Auth, error)

查询用户

type Claims

type Claims struct {
	Id    int64  `json:"id"`
	Auth  int64  `json:"auth"`
	Type  string `json:"type" xorm:"varchar(255)"`  // 权限类型
	Value string `json:"value" xorm:"varchar(255)"` // 权限指
}

用户权限表

func GetClaims

func GetClaims() ([]Claims, error)

查询所有权限

func GetClaimsByAuth

func GetClaimsByAuth(auth int64) ([]Claims, error)

查询用户权限

func GetUserClaims

func GetUserClaims(username string) ([]Claims, error)

type User

type User struct {
	Username string
	Claims   []Claims
}

用户表权限

func GetUser

func GetUser(username string) (*User, error)

Jump to

Keyboard shortcuts

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