users

package
v1.1.2 Latest Latest
Warning

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

Go to latest
Published: Feb 8, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Service

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

Service is a user domain service

func NewService

func NewService(users UserRepo, cfg *config.AppConfig) *Service

NewService creates a new user service

func (*Service) Create

func (s *Service) Create(ctx context.Context, newUser *usersmodels.NewUser) (*usersmodels.User, error)

Create creates a new user

func (*Service) Exists

func (s *Service) Exists(ctx context.Context, userID string) (bool, error)

Exists checks if a user exists

func (*Service) GetBalance

func (s *Service) GetBalance(ctx context.Context, userID string) (bsv.Satoshis, error)

GetBalance returns current balance for the user

func (*Service) GetByID

func (s *Service) GetByID(ctx context.Context, userID string) (*usersmodels.User, error)

GetByID returns a user with paymails

func (*Service) GetIDByPubKey

func (s *Service) GetIDByPubKey(ctx context.Context, pubKey string) (string, error)

GetIDByPubKey returns the user ID selected by pubKey

func (*Service) GetPubKey

func (s *Service) GetPubKey(ctx context.Context, userID string) (*primitives.PublicKey, error)

GetPubKey returns the go-sdk primitives.PublicKey object from the user's PubKey string selected by userID

func (*Service) Remove

func (s *Service) Remove(ctx context.Context, userID string) error

Remove removes current user

type UserRepo

type UserRepo interface {
	Exists(ctx context.Context, userID string) (bool, error)
	GetIDByPubKey(ctx context.Context, pubKey string) (string, error)
	Get(ctx context.Context, userID string) (*usersmodels.User, error)
	Create(ctx context.Context, newUser *usersmodels.NewUser) (*usersmodels.User, error)
	GetBalance(ctx context.Context, userID string, name bucket.Name) (bsv.Satoshis, error)
	Delete(ctx context.Context, userID string) error
}

UserRepo is an interface for users repository.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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