biz

package
v0.0.0-...-657e486 Latest Latest
Warning

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

Go to latest
Published: Oct 12, 2023 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

ProviderSet is biz providers.

Functions

This section is empty.

Types

type Card

type Card struct {
	Id              uuid.UUID
	Name            string
	Number          string
	Ccv             int32
	ExpirationYear  int32
	ExpirationMonth int32
}

type CardRepo

type CardRepo interface {
	Create(context.Context, uuid.UUID, *Card) *Card
	FindByID(context.Context, uuid.UUID) *Card
	ListByOwner(context.Context, uuid.UUID) []*Card
	Delete(context.Context, uuid.UUID)
}

CardRepo is a Greater repo.

type CardUsecase

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

func NewCardUsecase

func NewCardUsecase(repo CardRepo, logger log.Logger) *CardUsecase

NewCardUsecase new a Card usecase.

type User

type User struct {
	Id           uuid.UUID
	Name         string
	Email        string
	PasswordHash string
}

type UserRepo

type UserRepo interface {
	Create(context.Context, *User) (*User, error)
	FindByID(context.Context, uuid.UUID) (*User, error)
	Update(context.Context, *User) (*User, error)
	AddCards(context.Context, uuid.UUID, []*Card)
}

UserRepo is a Greater repo.

type UserUsecase

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

func NewUserUsecase

func NewUserUsecase(u UserRepo, c CardRepo, logger log.Logger) *UserUsecase

NewUserUsecase new a User usecase.

func (*UserUsecase) AddCard

func (uc *UserUsecase) AddCard(ctx context.Context, userId uuid.UUID, card *Card) *Card

AddCard a new card for a user

func (*UserUsecase) CreateUser

func (uc *UserUsecase) CreateUser(ctx context.Context, password string, user *User) (*User, error)

CreateUser creates a Greeter, and returns the new Greeter.

func (*UserUsecase) GetUser

func (uc *UserUsecase) GetUser(ctx context.Context, id uuid.UUID) (*User, error)

GetUser get user

func (*UserUsecase) ListCardsByOwner

func (uc *UserUsecase) ListCardsByOwner(ctx context.Context, userId uuid.UUID) []*Card

ListCardsByOwner a list of cards for a user

Jump to

Keyboard shortcuts

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