stores

package
v0.0.0-...-7934b4f Latest Latest
Warning

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

Go to latest
Published: Feb 25, 2023 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrCustomerNameConflict when creating a new customer a name conflict was found
	ErrCustomerNameConflict = errors.New("customer name already exists")
	// ErrCustomerNotFound when retrieving a customer the id wasn't found
	ErrCustomerNotFound = errors.New("customer not found")
)

Functions

This section is empty.

Types

type Customers

type Customers interface {
	GetCustomer(ctx context.Context, id string, into proto.Message) (int64, error)
	CreateCustomer(ctx context.Context, id, name string, obj proto.Message) (int64, error)
	ListCustomers(ctx context.Context, nextToken string, limit int) (string, []Record, error)
}

Customers store used to manage customers

func NewCustomers

func NewCustomers(awsconfig *aws.Config, cfg *flags.API) Customers

NewCustomers creates a new customer store

type DDBCustomers

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

DDBCustomers DynamoDB based customer store

func (*DDBCustomers) CreateCustomer

func (dc *DDBCustomers) CreateCustomer(ctx context.Context, id, name string, obj proto.Message) (int64, error)

CreateCustomer create a customer using the supplied message and return the version

func (*DDBCustomers) GetCustomer

func (dc *DDBCustomers) GetCustomer(ctx context.Context, id string, into proto.Message) (int64, error)

GetCustomer retrieve the customer and marshall it into the supplied message

func (*DDBCustomers) ListCustomers

func (dc *DDBCustomers) ListCustomers(ctx context.Context, nextToken string, limit int) (string, []Record, error)

ListCustomers list customers and retrieve the raw records for marshaling in the consuming method, this is done to avoid tying this method to a given storage model

type Record

type Record struct {
	Data    []byte
	Version int64
	ID      string
}

Record used to return raw record data

Jump to

Keyboard shortcuts

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