store

package
v0.0.0-...-35e1694 Latest Latest
Warning

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

Go to latest
Published: Jun 20, 2019 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

In memory store implementation

Interfaces store implementations must follow

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CustomerStorer

type CustomerStorer interface {
	// GetCustomers returns a list of customers matching query.
	GetCustomers(ctx context.Context) ([]*models.Customer, error)
	// CreateCustomer creates a new customer in the store.
	CreateCustomer(ctx context.Context, customerInput models.NewCustomer) (*models.Customer, error)
	// EditCustomer edits a customer in the store.
	EditCustomer(ctx context.Context, customerInput models.EditCustomer) (*models.Customer, error)
	// DeleteCustomer deletes an customer from the store.
	DeleteCustomer(ctx context.Context, ID string) error
}

CustomerStorer defines interfaces for interaction with customer objects.

type InMemoryStore

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

func NewInMemoryStore

func NewInMemoryStore() *InMemoryStore

func (*InMemoryStore) CreateCustomer

func (s *InMemoryStore) CreateCustomer(ctx context.Context, customerInput models.NewCustomer) (*models.Customer, error)

func (*InMemoryStore) CreateInvoice

func (s *InMemoryStore) CreateInvoice(ctx context.Context, invoiceInput models.NewInvoice) (*models.Invoice, error)

func (*InMemoryStore) DeleteCustomer

func (s *InMemoryStore) DeleteCustomer(ctx context.Context, id string) error

func (*InMemoryStore) DeleteInvoice

func (s *InMemoryStore) DeleteInvoice(ctx context.Context, id string) error

func (*InMemoryStore) EditCustomer

func (s *InMemoryStore) EditCustomer(ctx context.Context, customerInput models.EditCustomer) (*models.Customer, error)

func (*InMemoryStore) EditInvoice

func (s *InMemoryStore) EditInvoice(ctx context.Context, invoiceInput models.EditInvoice) (*models.Invoice, error)

func (*InMemoryStore) GetCustomers

func (s *InMemoryStore) GetCustomers(context.Context) ([]*models.Customer, error)

func (*InMemoryStore) GetInvoices

func (s *InMemoryStore) GetInvoices(context.Context) ([]*models.Invoice, error)

type InvoiceStorer

type InvoiceStorer interface {
	// GetInvoices returns a list of invoices matching query.
	GetInvoices(ctx context.Context) ([]*models.Invoice, error)
	// CreateInvoice creates a new Invoice in the store.
	CreateInvoice(ctx context.Context, invoiceInput models.NewInvoice) (*models.Invoice, error)
	// EditInvoice edits an Invoice in the store.
	EditInvoice(ctx context.Context, invoiceInput models.EditInvoice) (*models.Invoice, error)
	// DeleteInvoice deletes an invoice from the store.
	DeleteInvoice(ctx context.Context, ID string) error
}

InvoiceStorer defines interfaces for interaction with invoice objects.

type Storer

type Storer interface {
	InvoiceStorer
	CustomerStorer
}

Storer defines the interface to handle lazy-invoice data.

Jump to

Keyboard shortcuts

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