repository

package
v0.0.0-...-c606dee Latest Latest
Warning

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

Go to latest
Published: Apr 17, 2023 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var KVNotFound = redis.Nil

Functions

This section is empty.

Types

type AccountNoSQL

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

func NewAccountNoSQL

func NewAccountNoSQL(db NoSQL) AccountNoSQL

func (AccountNoSQL) Create

func (a AccountNoSQL) Create(ctx context.Context, account domain.Account) (domain.Account, error)

func (AccountNoSQL) FindAll

func (a AccountNoSQL) FindAll(ctx context.Context) ([]domain.Account, error)

func (AccountNoSQL) FindBalance

func (a AccountNoSQL) FindBalance(ctx context.Context, ID domain.AccountID) (domain.Account, error)

func (AccountNoSQL) FindByID

func (AccountNoSQL) UpdateBalance

func (a AccountNoSQL) UpdateBalance(ctx context.Context, ID domain.AccountID, balance domain.Money) error

type AccountSQL

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

func NewAccountSQL

func NewAccountSQL(db SQL) AccountSQL

func (AccountSQL) Create

func (a AccountSQL) Create(ctx context.Context, account domain.Account) (domain.Account, error)

func (AccountSQL) FindAll

func (a AccountSQL) FindAll(ctx context.Context) ([]domain.Account, error)

func (AccountSQL) FindBalance

func (a AccountSQL) FindBalance(ctx context.Context, ID domain.AccountID) (domain.Account, error)

func (AccountSQL) FindByID

func (a AccountSQL) FindByID(ctx context.Context, ID domain.AccountID) (domain.Account, error)

func (AccountSQL) UpdateBalance

func (a AccountSQL) UpdateBalance(ctx context.Context, ID domain.AccountID, balance domain.Money) error

type KeyValStoreImpl

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

func NewKeyValStore

func NewKeyValStore(db KeyValStoreIn) KeyValStoreImpl

func (KeyValStoreImpl) Del

func (r KeyValStoreImpl) Del(ctx context.Context, key []string) (int64, error)

func (KeyValStoreImpl) Get

func (r KeyValStoreImpl) Get(ctx context.Context, key string) (string, error)

func (KeyValStoreImpl) Set

func (r KeyValStoreImpl) Set(ctx context.Context, key string, val string, time time.Duration) error

type KeyValStoreIn

type KeyValStoreIn interface {
	Set(context.Context, string, string, time.Duration) error
	Get(context.Context, string) (string, error)
	Del(ctx context.Context, key []string) (int64, error)
}

type NoSQL

type NoSQL interface {
	Store(context.Context, string, interface{}) error
	Update(context.Context, string, interface{}, interface{}) error
	FindAll(context.Context, string, interface{}, interface{}) error
	FindOne(context.Context, string, interface{}, interface{}, interface{}) error
	Delete(context.Context, string, interface{}) error
	StartSession() (Session, error)
}

type RecipeNoSQL

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

func NewRecipeNoSQL

func NewRecipeNoSQL(db NoSQL) RecipeNoSQL

func (RecipeNoSQL) Create

func (r RecipeNoSQL) Create(ctx context.Context, recipe domain.Recipe) (domain.Recipe, error)

func (RecipeNoSQL) Delete

func (r RecipeNoSQL) Delete(ctx context.Context, ID domain.RecipeID) error

func (RecipeNoSQL) FindAll

func (r RecipeNoSQL) FindAll(ctx context.Context) ([]domain.Recipe, error)

func (RecipeNoSQL) FindByID

func (r RecipeNoSQL) FindByID(ctx context.Context, ID domain.RecipeID) (domain.Recipe, error)

func (RecipeNoSQL) Update

func (r RecipeNoSQL) Update(ctx context.Context, ID domain.RecipeID, recipe domain.Recipe) (domain.Recipe, error)

type Row

type Row interface {
	Scan(dest ...interface{}) error
}

type Rows

type Rows interface {
	Scan(dest ...interface{}) error
	Next() bool
	Err() error
	Close() error
}

type SQL

type SQL interface {
	ExecuteContext(context.Context, string, ...interface{}) error
	QueryContext(context.Context, string, ...interface{}) (Rows, error)
	QueryRowContext(context.Context, string, ...interface{}) Row
	BeginTx(ctx context.Context) (Tx, error)
}

type Session

type Session interface {
	WithTransaction(context.Context, func(context.Context) error) error
	EndSession(context.Context)
}

type TransferNoSQL

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

func NewTransferNoSQL

func NewTransferNoSQL(db NoSQL) TransferNoSQL

func (TransferNoSQL) Create

func (t TransferNoSQL) Create(ctx context.Context, transfer domain.Transfer) (domain.Transfer, error)

func (TransferNoSQL) FindAll

func (t TransferNoSQL) FindAll(ctx context.Context) ([]domain.Transfer, error)

func (TransferNoSQL) WithTransaction

func (t TransferNoSQL) WithTransaction(ctx context.Context, fn func(ctxTx context.Context) error) error

type TransferSQL

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

func NewTransferSQL

func NewTransferSQL(db SQL) TransferSQL

func (TransferSQL) Create

func (t TransferSQL) Create(ctx context.Context, transfer domain.Transfer) (domain.Transfer, error)

func (TransferSQL) FindAll

func (t TransferSQL) FindAll(ctx context.Context) ([]domain.Transfer, error)

func (TransferSQL) WithTransaction

func (t TransferSQL) WithTransaction(ctx context.Context, fn func(ctxTx context.Context) error) error

type Tx

type Tx interface {
	ExecuteContext(context.Context, string, ...interface{}) error
	QueryContext(context.Context, string, ...interface{}) (Rows, error)
	QueryRowContext(context.Context, string, ...interface{}) Row
	Commit() error
	Rollback() error
}

type UserNoSQL

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

func NewUserNoSQL

func NewUserNoSQL(db NoSQL) UserNoSQL

func (UserNoSQL) Create

func (r UserNoSQL) Create(ctx context.Context, user domain.User) (domain.User, error)

func (UserNoSQL) Delete

func (r UserNoSQL) Delete(ctx context.Context, ID domain.UserID) error

func (UserNoSQL) FindAll

func (r UserNoSQL) FindAll(ctx context.Context) ([]domain.User, error)

func (UserNoSQL) FindByEmail

func (a UserNoSQL) FindByEmail(ctx context.Context, email domain.Email) (domain.User, error)

func (UserNoSQL) FindByEmailAndPass

func (a UserNoSQL) FindByEmailAndPass(ctx context.Context, email string, password string) (domain.User, error)

func (UserNoSQL) FindByID

func (r UserNoSQL) FindByID(ctx context.Context, ID domain.UserID) (domain.User, error)

func (UserNoSQL) Update

func (r UserNoSQL) Update(ctx context.Context, ID domain.UserID, user domain.User) (domain.User, error)

Jump to

Keyboard shortcuts

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