postgres

package
v0.0.0-...-6c8972c Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2024 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MustNewDevelopmentDB

func MustNewDevelopmentDB(ddlConnStr, migrationDir string) (*sqlx.DB, func())

MustNewDevelopmentDB creates a new isolated database for the use of a package test The checking of dbconn is expected to be done in the package test using this

func RandString

func RandString(n int) string

Types

type Storage

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

func NewStorage

func NewStorage(dbstring string, logger *logrus.Entry) (*Storage, error)

NewStorage returns a new Storage from the provides psql databse string

func NewStorageDB

func NewStorageDB(db *sqlx.DB) *Storage

func NewTestStorage

func NewTestStorage(dbstring string, migrationDir string) (*Storage, func())

NewTestStorage returns a Storage that uses an isolated database for testing purposes and a teardown function

func (*Storage) Commit

func (s *Storage) Commit(ctx context.Context) error

func (*Storage) CreateBrand

func (s *Storage) CreateBrand(ctx context.Context, req storage.Brand) (string, error)

func (*Storage) CreateBrandValidation

func (s *Storage) CreateBrandValidation(ctx context.Context, req storage.Brand) error

func (*Storage) CreateCategory

func (s *Storage) CreateCategory(ctx context.Context, req storage.Category) (string, error)

func (*Storage) CreateCategoryValidation

func (s *Storage) CreateCategoryValidation(ctx context.Context, req storage.Category) error

func (*Storage) CreateRecipe

func (s *Storage) CreateRecipe(ctx context.Context, req storage.Recipe) (string, error)

func (*Storage) CreateRecipeValidation

func (s *Storage) CreateRecipeValidation(ctx context.Context, req storage.Recipe) error

func (Storage) DeleteAllRecipePermanently

func (s Storage) DeleteAllRecipePermanently(ctx context.Context) error

func (*Storage) DeleteBrand

func (s *Storage) DeleteBrand(ctx context.Context, id, deletedBy string) error

func (Storage) DeleteBrandsPermanently

func (s Storage) DeleteBrandsPermanently(ctx context.Context) error

func (*Storage) DeleteCategory

func (s *Storage) DeleteCategory(ctx context.Context, id, deletedBy string) error

func (*Storage) DeleteRecipe

func (s *Storage) DeleteRecipe(ctx context.Context, id, deletedBy string) error

func (*Storage) GetBrandByID

func (s *Storage) GetBrandByID(ctx context.Context, id string) (*storage.Brand, error)

func (*Storage) GetCategoryByID

func (s *Storage) GetCategoryByID(ctx context.Context, id string) (*storage.Category, error)

func (*Storage) GetRecipeByID

func (s *Storage) GetRecipeByID(ctx context.Context, id string) (*storage.Recipe, error)

func (*Storage) ListBrand

func (s *Storage) ListBrand(ctx context.Context, req storage.ListBrandFilter) ([]storage.Brand, error)

func (*Storage) ListCategories

func (s *Storage) ListCategories(ctx context.Context, req storage.ListCategoryFilter) ([]storage.Category, error)

func (*Storage) ListRecipe

func (s *Storage) ListRecipe(ctx context.Context, req storage.ListRecipeFilter) ([]storage.Recipe, error)

func (*Storage) NewTransacton

func (s *Storage) NewTransacton(ctx context.Context) (context.Context, error)

func (*Storage) Rollback

func (s *Storage) Rollback(ctx context.Context) error

func (*Storage) RunMigration

func (s *Storage) RunMigration(dir string) error

RunMigration runs the migrations in the dir using the goose package

func (*Storage) UpdateBrand

func (s *Storage) UpdateBrand(ctx context.Context, sc storage.Brand) (*storage.Brand, error)

func (*Storage) UpdateCategory

func (s *Storage) UpdateCategory(ctx context.Context, sc storage.Category) (*storage.Category, error)

func (*Storage) UpdateRecipe

func (s *Storage) UpdateRecipe(ctx context.Context, sc storage.Recipe) (*storage.Recipe, error)

Jump to

Keyboard shortcuts

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