users

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Feb 6, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrUserEmailNotFound      = errors.New("user with the email not found")
	ErrUserEmailAlreadyExists = errors.New("user with the email already exists")
	QueryTimeoutDuration      = 5 * time.Second
)

Functions

func NewPostgresStore

func NewPostgresStore(pqdriver *pgxpool.Pool, tablename string) *pgstore

Types

type User

type User struct {
	ID             string `json:"id"`
	FullName       string `json:"fullName"`
	Email          string `json:"email"`
	Password       []byte `json:"-"`
	Phone          string `json:"phone"`
	ContactAddress string `json:"contactAddress"`
}

func (*User) CheckPassword

func (us *User) CheckPassword(plain string) bool

func (*User) HashPassword

func (us *User) HashPassword() error

func (*User) Sanitize

func (us *User) Sanitize()

func (*User) ValidateForCreate

func (us *User) ValidateForCreate() error

ValidateForCreate runs the validation required for when a user is being created. i.e. ID is not available

type Users

type Users struct {
	// contains filtered or unexported fields
}

func NewService

func NewService(store store) *Users

func (*Users) AsyncRegisters

func (us *Users) AsyncRegisters(ctx context.Context, users []User) error

func (*Users) Login

func (us *Users) Login(ctx context.Context, email, password string) (*User, error)

func (*Users) ReadByEmail

func (us *Users) ReadByEmail(ctx context.Context, email string) (*User, error)

func (*Users) Register

func (us *Users) Register(ctx context.Context, user *User) (*User, error)

Jump to

Keyboard shortcuts

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