inmemory

package
v0.3.2 Latest Latest
Warning

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

Go to latest
Published: May 19, 2022 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DeckToDomainDeck added in v0.3.0

func DeckToDomainDeck(rd *Deck) (*deck.Deck, error)

DeckToDomainDeck transforms a repo deck to a domain deck.

Types

type Deck added in v0.3.0

type Deck struct {
	ID          string
	Shuffled    bool
	Composition string
	Codes       []string
}

Deck represents a deck of cards.

func DomainDeckToDeck added in v0.3.0

func DomainDeckToDeck(d *deck.Deck) *Deck

DomainDeckToDeck transforms a domain deck to a repo deck.

type Repository

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

Repository is an in-memory implementation of the deckr.Repository interface.

func NewRepository

func NewRepository(log *logger.Logger) *Repository

NewRepository creates a new in-memory repository.

func (*Repository) Get

func (r *Repository) Get(_ context.Context, id string) (*deck.Deck, error)

Get returns the deck with the given id.

func (*Repository) Migrate added in v0.3.0

func (r *Repository) Migrate(_ context.Context) error

Migrate migrates the deck model.

func (*Repository) Save

func (r *Repository) Save(_ context.Context, d *deck.Deck) error

Save saves the given deck.

Jump to

Keyboard shortcuts

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