productdb

package
v0.0.0-...-3ec19d7 Latest Latest
Warning

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

Go to latest
Published: Jan 19, 2023 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Overview

Package productdb contains product related CRUD functionality.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Store

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

Store manages the set of APIs for product database access.

func NewStore

func NewStore(log *zap.SugaredLogger, db *sqlx.DB) *Store

NewStore constructs the api for data access.

func (*Store) Create

func (s *Store) Create(ctx context.Context, prd product.Product) error

Create adds a Product to the database. It returns the created Product with fields like ID and DateCreated populated.

func (*Store) Delete

func (s *Store) Delete(ctx context.Context, prd product.Product) error

Delete removes the product identified by a given ID.

func (*Store) Query

func (s *Store) Query(ctx context.Context, filter product.QueryFilter, orderBy order.By, pageNumber int, rowsPerPage int) ([]product.Product, error)

Query gets all Products from the database.

func (*Store) QueryByID

func (s *Store) QueryByID(ctx context.Context, productID uuid.UUID) (product.Product, error)

QueryByID finds the product identified by a given ID.

func (*Store) QueryByUserID

func (s *Store) QueryByUserID(ctx context.Context, userID uuid.UUID) ([]product.Product, error)

QueryByUserID finds the product identified by a given User ID.

func (*Store) Update

func (s *Store) Update(ctx context.Context, prd product.Product) error

Update modifies data about a Product. It will error if the specified ID is invalid or does not reference an existing Product.

Jump to

Keyboard shortcuts

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