mem

package
v0.0.0-...-05eea06 Latest Latest
Warning

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

Go to latest
Published: Jul 2, 2023 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 Repo

type Repo struct {
	Users   []*api.User
	Markets []*api.Market
	Bets    []*api.Bet
	// contains filtered or unexported fields
}

Repo is an in-memory persistence repository.

func (*Repo) CreateBet

func (r *Repo) CreateBet(_ context.Context, bet *api.Bet) error

CreateBet creates a new bet.

func (*Repo) CreateMarket

func (r *Repo) CreateMarket(_ context.Context, market *api.Market) error

CreateMarket creates a new market.

func (*Repo) CreateUser

func (r *Repo) CreateUser(_ context.Context, user *api.User) error

CreateUser creates a new user.

func (*Repo) GetBet

func (r *Repo) GetBet(_ context.Context, name string) (*api.Bet, error)

GetBet gets a bet by ID.

func (*Repo) GetMarket

func (r *Repo) GetMarket(_ context.Context, name string) (*api.Market, error)

GetMarket gets a market by ID.

func (*Repo) GetUser

func (r *Repo) GetUser(ctx context.Context, name string) (*api.User, error)

GetUser gets a user by ID.

func (*Repo) GetUserByUsername

func (r *Repo) GetUserByUsername(ctx context.Context, book, username string) (*api.User, error)

GetUserByUsername gets a user by username.

func (*Repo) ListBets

func (r *Repo) ListBets(_ context.Context, args *repo.ListBetsArgs) (bets []*api.Bet, hasMore bool, err error)

ListBets lists bets by filters.

func (*Repo) ListMarkets

func (r *Repo) ListMarkets(_ context.Context, args *repo.ListMarketsArgs) (markets []*api.Market, hasMore bool, err error)

ListMarkets lists markets by filters.

func (*Repo) ListUsers

func (r *Repo) ListUsers(ctx context.Context, args *repo.ListUsersArgs) (users []*api.User, hasMore bool, err error)

ListUsers lists users by filters.

func (*Repo) UpdateBet

func (r *Repo) UpdateBet(_ context.Context, bet *api.Bet) error

UpdateBet updates a bet.

func (*Repo) UpdateMarket

func (r *Repo) UpdateMarket(_ context.Context, market *api.Market) error

UpdateMarket updates a market.

func (*Repo) UpdateUser

func (r *Repo) UpdateUser(_ context.Context, user *api.User) error

UpdateUser updates a user.

Jump to

Keyboard shortcuts

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