models

package
v0.0.0-...-5f9580c Latest Latest
Warning

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

Go to latest
Published: Feb 10, 2019 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Endpoint

type Endpoint struct {
	//  `ID`, `CreatedAt`, `UpdatedAt`, `DeletedAt`
	gorm.Model
	Hits int64          `gorm:"default:0"`
	User string         `gorm:"-" json:"user" form:"user" query:"user"`
	Slug string         `gorm:"unique,not null" json:"slug" form:"slug" query:"slug"`
	Data postgres.Jsonb `gorm:"not null" json:"data" form:"data" query:"data"`
}

type JwtCustomClaims

type JwtCustomClaims struct {
	ID   uint `json:"id"`
	Role uint `json:"role"`
	jwt.StandardClaims
}

jwtCustomClaims are custom claims extending default ones.

type User

type User struct {
	gorm.Model
	Role         uint   `gorm:"index;not null;default:'2'" json:"role,omitempty" valid:"int, required"`
	FirstName    string `gorm:"type:varchar(155);not null" json:"first_name,omitempty" valid:"required"`
	LastName     string `gorm:"type:varchar(155);not null" json:"last_name,omitempty" valid:"required"`
	Password     string `gorm:"type:varchar(128); not null" json:"password,omitempty" valid:"required"`
	Email        string `gorm:"type:varchar(100);unique_index" json:"email,omitempty" valid:"email,required"`
	RecoverToken string `gorm:"type:varchar(128); not null" json:"recover_token,omitempty" valid:"required"`
	Enabled      bool   `gorm:"default:'true'" json:"enabled,omitempty"`
}

func (*User) GenerateUserLogged

func (u *User) GenerateUserLogged() *UserLogged

func (*User) SetPassword

func (u *User) SetPassword()

type UserLogged

type UserLogged struct {
	ID        uint   `json:"id"`
	FirstName string `json:"first_name,omitempty"`
	LastName  string `json:"last_name,omitempty"`
	Email     string `json:"email,omitempty"`
	Role      uint   `json:"role"`
	Jwt       string
}

type UserRegister

type UserRegister struct {
	Email     string `json:"email" valid:"email,required"`
	Password1 string `json:"password1" valid:"required"`
	Password2 string `json:"password2" valid:"required"`
}

Jump to

Keyboard shortcuts

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