models

package
v0.0.0-...-b3bf69a Latest Latest
Warning

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

Go to latest
Published: Sep 9, 2020 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetDB

func GetDB() *gorm.DB

func GetUserById

func GetUserById(id uint) (map[string]interface{}, int)

Types

type ResponseAuthentication

type ResponseAuthentication struct {
	Token   string `json:"token"`
	Expired string `json:"expired"`
}

type ResponseUser

type ResponseUser struct {
	Id       uint                   `json:"id" gorm:"primaryKey;autoIncrement:true"`
	Username string                 `json:"username"`
	Name     string                 `json:"name"`
	Auth     ResponseAuthentication `json:"auth"`
}

func Login

func Login(username, password string) (*ResponseUser, map[string]interface{}, int)

type User

type User struct {
	gorm.Model
	Id       uint   `json:"id" gorm:"primaryKey;autoIncrement:true"`
	Username string `json:"username"`
	Password string `json:"password"`
	Name     string `json:"name"`
}

func (*User) Create

func (u *User) Create() (*ResponseUser, map[string]interface{}, int)

func (*User) Validate

func (u *User) Validate() (map[string]interface{}, int)

Jump to

Keyboard shortcuts

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