mongodb

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Oct 26, 2020 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrCPFAlreadyExists = errors.New("this cpf could not be inserted in our DB")
View Source
var ErrNoAccountWasFound = errors.New("no account was found with the given filter parameters")
View Source
var ErrNoTokenWasFound = errors.New("no token was found with the given filter parameters")

Functions

This section is empty.

Types

type Account

type Account struct {
	ID        primitive.ObjectID `bson:"_id"`
	Name      string             `bson:"name"`
	CPF       string             `bson:"cpf"`
	Secret    string             `bson:"secret"`
	Balance   float64            `bson:"balance"`
	CreatedAt time.Time          `bson:"created_at"`
}

type Storage

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

func NewStorageFromEnv

func NewStorageFromEnv() (*Storage, error)

func (*Storage) AddAccount

func (s *Storage) AddAccount(ctx context.Context, account adding.Account) (string, error)

func (*Storage) AddToken

func (s *Storage) AddToken(ctx context.Context, token authenticating.Token) error

func (*Storage) AddTransfer

func (s *Storage) AddTransfer(ctx context.Context, transfer adding.Transfer) (string, error)

func (*Storage) Connect

func (s *Storage) Connect(ctx context.Context)

func (*Storage) CreateIndexes

func (s *Storage) CreateIndexes(ctx context.Context)

func (*Storage) Disconnect

func (s *Storage) Disconnect(ctx context.Context)

func (*Storage) GetAccountByCPF

func (s *Storage) GetAccountByCPF(ctx context.Context, cpf string) (listing.Account, error)

func (*Storage) GetAccountByID

func (s *Storage) GetAccountByID(ctx context.Context, id string) (listing.Account, error)

func (*Storage) GetAccounts

func (s *Storage) GetAccounts(ctx context.Context) ([]listing.Account, error)

func (*Storage) GetTokenByID

func (s *Storage) GetTokenByID(ctx context.Context, id primitive.ObjectID) (authenticating.Token, error)

func (*Storage) GetTransfersByKey

func (s *Storage) GetTransfersByKey(ctx context.Context, transferKey string, transferValue string) ([]listing.Transfer, error)

func (*Storage) UpdateAccounts

func (s *Storage) UpdateAccounts(ctx context.Context, accounts []updating.Account) error

type Transfer

type Transfer struct {
	ID                   primitive.ObjectID `bson:"_id"`
	OriginAccountID      primitive.ObjectID `bson:"account_origin_id"`
	DestinationAccountID primitive.ObjectID `bson:"account_destination_id"`
	Amount               float64            `bson:"amount"`
	CreatedAt            time.Time          `bson:"created_at"`
}

Jump to

Keyboard shortcuts

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