models

package
v0.0.0-...-d12d41b Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	RoleUser  = "ROLE_USER"
	RoleAdmin = "ROLE_ADMIN"
)

Variables

View Source
var DB *gorm.DB

Functions

func AddUser

func AddUser(user *User) e.Error

func InitDB

func InitDB()

Types

type Role

type Role struct {
	gorm.Model
	RoleName string `json:"role_name"`
}

type User

type User struct {
	gorm.Model
	Username string `json:"username"`
	Password string `json:"password"`
	RoleId   int64  `json:"role_id"`
	Role     Role   `json:"-"`
}

func FindUserByUsername

func FindUserByUsername(username string) (*User, e.Error)

func FindUserByUsernameWithRole

func FindUserByUsernameWithRole(username string) (*User, e.Error)

func ListUsers

func ListUsers() ([]User, e.Error)

Jump to

Keyboard shortcuts

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