product

package
v0.5.1 Latest Latest
Warning

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

Go to latest
Published: Mar 8, 2023 License: MIT Imports: 1 Imported by: 12

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AttributeFilter

type AttributeFilter struct {
	Key        string
	Value      *string
	ValueRegex *string
}

AttributeFilter is used for filtering of products by attribute.

type Filter

type Filter struct {
	Provider         *string
	SKU              *string
	Service          *string
	Family           *string
	Location         *string
	AttributeFilters []*AttributeFilter
}

Filter is used to filter products.

type ID

type ID uint32

ID represents the Product ID.

type Product

type Product struct {
	ID         ID
	Provider   string
	SKU        string
	Service    string
	Family     string
	Location   string
	Attributes map[string]string
}

Product is an entry of a single SKU.

type Repository

type Repository interface {
	// Filter returns Products with attributes matching the Filter.
	Filter(ctx context.Context, filter *Filter) ([]*Product, error)

	// FindByVendorAndSKU finds a single Product by its vendor and SKU.
	FindByVendorAndSKU(ctx context.Context, vendor string, sku string) (*Product, error)

	// Upsert updates a Product or creates a new one if it doesn't already exist.
	Upsert(ctx context.Context, p *Product) (ID, error)
}

Repository describes interactions with a storage system to deal with Product entries.

Jump to

Keyboard shortcuts

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