data

package
v0.0.0-...-e7f4c4f Latest Latest
Warning

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

Go to latest
Published: Jan 3, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

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

Functions

func GenerateHash

func GenerateHash(password string) (string, error)

Types

type Models

type Models struct {
	Users UserModel
}

func NewModels

func NewModels(db *pgxpool.Pool) Models

type User

type User struct {
	Id        int64     `json:"id"`
	FirstName string    `json:"firstName"`
	LastName  string    `json:"lastName"`
	Email     string    `json:"email"`
	Password  string    `json:"-"`
	CreatedAt time.Time `json:"-"`
}

func (*User) ValidatePassword

func (u *User) ValidatePassword(plainText string) (bool, error)

type UserModel

type UserModel struct {
	DB *pgxpool.Pool
}

func (*UserModel) GetUserByEmail

func (m *UserModel) GetUserByEmail(email string) (*User, error)

func (*UserModel) GetUserById

func (m *UserModel) GetUserById(id int64) (*User, error)

func (*UserModel) Insert

func (m *UserModel) Insert(user *User) (*User, error)

Jump to

Keyboard shortcuts

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