entity

package
v0.0.0-...-4f9ff06 Latest Latest
Warning

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

Go to latest
Published: Mar 6, 2022 License: BSD-2-Clause Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ErrCreateSession = "fail on create session"
	ErrFindUser      = "fail on find user"
)

ErrCreateSession create session

Variables

View Source
var ErrGeneratePassword = errors.New("error on generate hash of password")

ErrGeneratePassword generate password

View Source
var ErrInvalidEntity = errors.New("invalid entity")

ErrInvalidEntity invalid entity

View Source
var ErrNotFound = errors.New("not found")

ErrNotFound not found

Functions

This section is empty.

Types

type Login

type Login struct {
	Email    string `json:"email" binding:"required"`
	Password string `json:"password" binding:"required"`
}

type LoginResponse

type LoginResponse struct {
	Token   string `json:"token"`
	Message string `json:"message"`
}

type Signup

type Signup struct {
	Name      string `json:"name" binding:"required"`
	Email     string `json:"email" binding:"required"`
	BirthDate string `json:"birthDate"`
	Password  string `json:"password" binding:"required"`
}

type User

type User struct {
	ID        int64  `gorm:"primaryKey" json:"id"`
	Name      string `gorm:"type:varchar(200)" json:"name"`
	Email     string `gorm:"type:varchar(100);not null;unique_index" json:"email"`
	BirthDate time.Time
	Password  string `gorm:"type:varchar(255)" json:"password"`
	CreatedAt time.Time
	UpdatedAt time.Time
	DeletedAt gorm.DeletedAt
}

func NewUser

func NewUser(name, email, password, birthdate string) (*User, error)

NewUser create a new user

func (*User) UpdatePassword

func (u *User) UpdatePassword(password string) error

func (*User) Validate

func (u *User) Validate() error

Validate validate user

func (*User) ValidatePassword

func (u *User) ValidatePassword(password string) bool

Jump to

Keyboard shortcuts

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