userModel

package
v0.0.0-...-0e46a4d Latest Latest
Warning

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

Go to latest
Published: Jun 21, 2022 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Repository

type Repository interface {
	GetAll(ctx context.Context) (*[]User, error)
	GetOne(ctx context.Context, id uint) (*User, error)
	GetByUsername(ctx context.Context, username string) (*User, error)
	Create(ctx context.Context, user User) (*User, error)
	Update(ctx context.Context, id uint, user User) (*User, error)
	Delete(ctx context.Context, id uint) error
}

Repository handle the CRUD operations with Users.

type User

type User struct {
	ID           uint      `json:"id,omitempty" example:"1"`
	FirstName    string    `json:"first_name,omitempty" example:"Matias"`
	LastName     string    `json:"last_name,omitempty" example:"Lamela"`
	Username     string    `json:"username,omitempty" example:"escalera92"`
	Email        string    `json:"email,omitempty" example:"matiaslamela1992@gmail.com"`
	Picture      string    `` /* 139-byte string literal not displayed */
	Password     string    `json:"password,omitempty" example:"1234"`
	PasswordHash string    `json:"-"`
	CreatedAt    time.Time `json:"created_at,omitempty"`
	UpdatedAt    time.Time `json:"updated_at,omitempty"`
}

func (*User) HashPassword

func (u *User) HashPassword() error

func (*User) PasswordMatch

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

Jump to

Keyboard shortcuts

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