Documentation ¶
Overview ¶
In memory store implementation
Interfaces store implementations must follow
Index ¶
- type CustomerStorer
- type InMemoryStore
- func (s *InMemoryStore) CreateCustomer(ctx context.Context, customerInput models.NewCustomer) (*models.Customer, error)
- func (s *InMemoryStore) CreateInvoice(ctx context.Context, invoiceInput models.NewInvoice) (*models.Invoice, error)
- func (s *InMemoryStore) DeleteCustomer(ctx context.Context, id string) error
- func (s *InMemoryStore) DeleteInvoice(ctx context.Context, id string) error
- func (s *InMemoryStore) EditCustomer(ctx context.Context, customerInput models.EditCustomer) (*models.Customer, error)
- func (s *InMemoryStore) EditInvoice(ctx context.Context, invoiceInput models.EditInvoice) (*models.Invoice, error)
- func (s *InMemoryStore) GetCustomers(context.Context) ([]*models.Customer, error)
- func (s *InMemoryStore) GetInvoices(context.Context) ([]*models.Invoice, error)
- type InvoiceStorer
- type Storer
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 (*InMemoryStore) GetInvoices ¶
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.
Click to show internal directories.
Click to hide internal directories.