postgres

package
v0.3.3 Latest Latest
Warning

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

Go to latest
Published: Jun 9, 2022 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DeckToDomainDeck

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

DeckToDomainDeck transforms a repo deck to a domain deck.

Types

type Deck

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

Deck represents a deck of cards.

func DomainDeckToDeck

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 a PostgreSQL implementation of the deckr.Repository interface.

func NewRepository

func NewRepository(ctx context.Context, uri string, log *logger.Logger) (*Repository, error)

NewRepository creates a new PostgreSQL repository.

func (*Repository) Close added in v0.3.3

func (r *Repository) Close(ctx context.Context) error

Close closes any external connection in the repository.

func (*Repository) Get

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

Get returns the deck with the given id.

func (*Repository) Migrate

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

Migrate migrates the deck model.

func (*Repository) Save

func (r *Repository) Save(ctx 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