user

package
v0.5.4 Latest Latest
Warning

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

Go to latest
Published: Sep 28, 2023 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNotFound      = errors.New("user not found")
	ErrWrongPassword = errors.New("wrong password provided")
	ErrAlreadyExists = errors.New("user already exists")
	ErrRestricted    = errors.New("access restricted")
)

Functions

This section is empty.

Types

type Service

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

func New

func New(store repository.Storage, pub bus.Publisher, registryService *registry.Service, logger *zerolog.Logger) *Service

func (*Service) GetByEmail

func (s *Service) GetByEmail(ctx context.Context, email string) (*User, error)

func (*Service) GetByEmailWithPasswordCheck

func (s *Service) GetByEmailWithPasswordCheck(ctx context.Context, email, password string) (*User, error)

func (*Service) GetByID

func (s *Service) GetByID(ctx context.Context, id int64) (*User, error)

func (*Service) Register

func (s *Service) Register(ctx context.Context, email, pass string) (*User, error)

Register registers user via email. If user already exists, return User and ErrAlreadyExists

func (*Service) ResolveWithGoogle

func (s *Service) ResolveWithGoogle(ctx context.Context, user *auth.GoogleUser) (*User, error)

func (*Service) UpdatePassword

func (s *Service) UpdatePassword(ctx context.Context, id int64, pass string) (*User, error)

type User

type User struct {
	ID              int64
	Name            string
	Email           string
	UUID            uuid.UUID
	GoogleID        *string
	ProfileImageURL *string
	CreatedAt       time.Time
	UpdatedAt       time.Time
	DeletedAt       *time.Time
	Settings        []byte
}

Jump to

Keyboard shortcuts

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