models

package
v0.0.0-...-a53b0bf Latest Latest
Warning

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

Go to latest
Published: Jan 24, 2021 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConnectAndMigrate

func ConnectAndMigrate() *gorm.DB

Types

type Role

type Role struct {
	ID        uint64 `gorm:"primarykey"`
	Name      string `gorm:"size:20;unique"`
	CreatedAt time.Time
	UpdatedAt time.Time
	DeletedAt gorm.DeletedAt `gorm:"index"`
}

type User

type User struct {
	ID             uint64 `gorm:"primarykey"`
	CreatedAt      time.Time
	UpdatedAt      time.Time
	DeletedAt      gorm.DeletedAt `gorm:"index"`
	RoleID         uint64         `gorm:"not null"`
	Role           Role           `gorm:"not null"`
	FirstName      string         `gorm:"size:255"`
	LastName       string         `gorm:"size:255"`
	Email          string         `gorm:"type:varchar(100);index"`
	Username       string         `gorm:"type:varchar(30);index;unique"`
	HashedPassword string         `gorm:"type:varchar(255)"`
	Gender         string
	IsActive       bool
	IsAdmin        bool `gorm:"-"`
}

func (*User) ConvertToProtoBuf

func (user *User) ConvertToProtoBuf() *pb.User

func (*User) FillFromProtoBuf

func (user *User) FillFromProtoBuf(pbUser *pb.User)

func (*User) PasswordIsCorrect

func (user *User) PasswordIsCorrect(rawPassword string) bool

func (*User) SetNewPassword

func (user *User) SetNewPassword(rawPassword string)

Jump to

Keyboard shortcuts

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