infrastructure

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Jul 14, 2020 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type GenerateID

type GenerateID func() string

GenerateID generates a unique identifier.

type PostgresBeerRepository

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

PostgresBeerRepository is a postgres beer repository.

func NewPostgresBeerRepository

func NewPostgresBeerRepository(settings *PostgresSettings,
	generateID GenerateID) (*PostgresBeerRepository, error)

NewPostgresBeerRepository creates a new postgres beer repository.

func (*PostgresBeerRepository) Close

func (repo *PostgresBeerRepository) Close() error

Close closes the postgres database.

func (*PostgresBeerRepository) CreateBeer

func (repo *PostgresBeerRepository) CreateBeer(ctx context.Context, params *domain.CreateBeerParams) (*domain.Beer, error)

CreateBeer creates a beer in the postgres database.

func (*PostgresBeerRepository) DeleteBeer

func (repo *PostgresBeerRepository) DeleteBeer(ctx context.Context, params *domain.DeleteBeerParams) error

DeleteBeer deletes a beer from the postgres database.

func (*PostgresBeerRepository) GetBeer

func (repo *PostgresBeerRepository) GetBeer(ctx context.Context, params *domain.GetBeerParams) (*domain.Beer, error)

GetBeer gets a beer from the postgres database.

func (*PostgresBeerRepository) ListBeers

func (repo *PostgresBeerRepository) ListBeers(ctx context.Context, params *domain.ListBeersParams) ([]*domain.Beer, error)

ListBeers lists all beers from the postgres database.

func (*PostgresBeerRepository) UpdateBeer

func (repo *PostgresBeerRepository) UpdateBeer(ctx context.Context, params *domain.UpdateBeerParams) (*domain.Beer, error)

UpdateBeer updates a beer in the postgres database.

type PostgresSettings

type PostgresSettings struct {
	Host     string
	Port     int
	User     string
	Password string
	DBName   string
}

PostgresSettings describes all the settings required for setting up a connection to a postgres database.

func (*PostgresSettings) String

func (s *PostgresSettings) String() string

String returns the string representation for a postgres database.

Jump to

Keyboard shortcuts

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