domain

package
v0.0.0-...-29a8be6 Latest Latest
Warning

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

Go to latest
Published: Jun 28, 2020 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Base

type Base struct {
	ID        string    `json:"id" gorm:"type:uuid;primary_key" valid:"notnull,uuid"`
	CreatedAt time.Time `json:"created_at" valid:"required"`
	UpdatedAt time.Time `json:"updated_at" valid:"-"`
}

Base represents a default entity

type User

type User struct {
	Base     `valid:"required"`
	Name     string `json:"name" gorm:"type:varchar(255)" valid:"notnull"`
	Email    string `json:"email" gorm:"type:varchar(255);unique_index" valid:"notnull,email"`
	Password string `json:"-" gorm:"type:varchar(255)" valid:"notnull"`
	Token    string `json:"token" gorm:"type:varchar(255);unique_index" valid:"notnull,uuid"`
}

User is a domain user

func NewUser

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

NewUser makes a new instance of User

func (*User) IsCorrectPassword

func (user *User) IsCorrectPassword(password string) bool

IsCorrectPassword compare password with hash

func (*User) Prepare

func (user *User) Prepare() error

Prepare defines defaults for User

Jump to

Keyboard shortcuts

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