user

package
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: Jun 14, 2026 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package user present full API functionality of the specific object

Index

Constants

This section is empty.

Variables

View Source
var Anonymous = User{ID: 0}

Anonymous user object

Functions

This section is empty.

Types

type ListFilter

type ListFilter struct {
	UserID []uint64
	Emails []string
}

ListFilter object with filtered values which is not NULL

func (*ListFilter) PrepareQuery

func (fl *ListFilter) PrepareQuery(q *gorm.DB) *gorm.DB

PrepareQuery returns the query with applied filters

type ListOptions added in v0.4.0

type ListOptions = repository.ListOptions

ListOptions is the list options struct

type ListOrder

type ListOrder struct {
	ID        Order
	Email     Order
	Status    Order
	CreatedAt Order
	UpdatedAt Order
}

ListOrder object with order values which is not NULL

func (*ListOrder) PrepareQuery

func (ord *ListOrder) PrepareQuery(q *gorm.DB) *gorm.DB

PrepareQuery returns the query with applied order

type Order added in v0.4.0

type Order = models.Order

Order Ascending or Descending for query fields

type Pagination added in v0.4.0

type Pagination = repository.Pagination

Pagination is the pagination object

type QOption added in v0.4.0

type QOption = repository.QOption

QOption is the query option interface

type Repository

type Repository interface {
	Get(ctx context.Context, id uint64) (*User, error)
	GetByEmail(ctx context.Context, email string) (*User, error)
	GetByPassword(ctx context.Context, email, password string) (*User, error)
	FetchList(ctx context.Context, opts ...QOption) ([]*User, error)
	Count(ctx context.Context, opts ...QOption) (int64, error)

	Create(ctx context.Context, user *User, password string) (uint64, error)
	Update(ctx context.Context, user *User) error
	Delete(ctx context.Context, id uint64) error

	SetPassword(ctx context.Context, user *User, password string) error

	CreateResetPassword(ctx context.Context, userID uint64) (*UserPasswordReset, error)
	GetResetPassword(ctx context.Context, userID uint64, token string) (*UserPasswordReset, error)
	EliminateResetPassword(ctx context.Context, userID uint64) error
}

Repository describes basic user methods

type Usecase

type Usecase interface {
	Get(ctx context.Context, id uint64) (*User, error)
	GetByEmail(ctx context.Context, email string) (*User, error)
	GetByPassword(ctx context.Context, email, password string) (*User, error)
	FetchList(ctx context.Context, opts ...QOption) ([]*User, error)
	Count(ctx context.Context, opts ...QOption) (int64, error)

	Create(ctx context.Context, user *User, password string) (uint64, error)
	Update(ctx context.Context, user *User) error
	Delete(ctx context.Context, id uint64) error

	SetPassword(ctx context.Context, user *User, password string) error
	ResetPassword(ctx context.Context, email string) (*UserPasswordReset, *User, error)
	UpdatePassword(ctx context.Context, token, email, password string) error
}

Usecase describes basic user methods

type User added in v0.4.0

type User = models.User

User is the main user model

type UserPasswordReset added in v0.4.0

type UserPasswordReset = models.UserPasswordReset

UserPasswordReset is the model for password reset tokens

Directories

Path Synopsis
delivery
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.
Package repository implements methods of working with the repository objects
Package repository implements methods of working with the repository objects
Package usecase user managing
Package usecase user managing

Jump to

Keyboard shortcuts

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