gob

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: 11 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 {
	Mem      *mem.Repo
	FileName string
	// contains filtered or unexported fields
}

Repo is an file-backed gob persistence repository.

func New

func New(fileName string) (*Repo, error)

New initializes a Gob-backed repository.

func (*Repo) CreateBet

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

CreateBet creates a new user.

func (*Repo) CreateMarket

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

CreateMarket creates a new market.

func (*Repo) CreateUser

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

CreateUser creates a new user.

func (*Repo) GetBet

func (r *Repo) GetBet(ctx context.Context, id string) (*api.Bet, error)

GetBet gets a bet by ID.

func (*Repo) GetMarket

func (r *Repo) GetMarket(ctx context.Context, id string) (*api.Market, error)

GetMarket gets a market by ID.

func (*Repo) GetUser

func (r *Repo) GetUser(ctx context.Context, id 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(ctx context.Context, args *repo.ListBetsArgs) ([]*api.Bet, bool, error)

ListBets lists bets.

func (*Repo) ListMarkets

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

ListMarkets lists markets.

func (*Repo) ListUsers

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

ListUsers lists users.

func (*Repo) UpdateBet

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

UpdateBet updates a bet.

func (*Repo) UpdateMarket

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

UpdateMarket updates a market.

func (*Repo) UpdateUser

func (r *Repo) UpdateUser(ctx 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