sqlstore

package
v0.0.32 Latest Latest
Warning

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

Go to latest
Published: Jan 15, 2022 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type OperationRepository

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

OperationRepository is responsible for operations data.

func (*OperationRepository) Create

func (r *OperationRepository) Create(ctx context.Context, operations ...*model.Operation) error

Create adds new records to the operations table. TODO: Benchmark & Speed Up (Batch INSERT).

func (*OperationRepository) DeleteByResourceID

func (r *OperationRepository) DeleteByResourceID(ctx context.Context, id int64) (int64, error)

DeleteByResourceID removes records with specified resource_id from operations table.

func (*OperationRepository) FindByNumber

func (r *OperationRepository) FindByNumber(ctx context.Context, number string, limit uint64, order string) ([]model.Operation, error)

FindByNumber returns list operations on vehicles with specified number plates.

func (*OperationRepository) FindByVIN added in v0.0.29

func (r *OperationRepository) FindByVIN(ctx context.Context, vin string, limit uint64, order string) ([]model.Operation, error)

FindByNumber returns list operations on vehicles with specified number plates.

type ResourceRepository

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

ResourceRepository is responsible for resources data.

func (*ResourceRepository) All

func (*ResourceRepository) Create

func (r *ResourceRepository) Create(ctx context.Context, resource *model.Resource) error

func (*ResourceRepository) FindByUID

func (r *ResourceRepository) FindByUID(ctx context.Context, uid string) (*model.Resource, error)

func (*ResourceRepository) Update

func (r *ResourceRepository) Update(ctx context.Context, resource *model.Resource) error

type Store

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

Store is an implementation of domain.Store interface based on SQL.

func New

func New(settings *config.Database) (*Store, error)

New returns new instance of Store.

func TestDB

func TestDB(t *testing.T, conf *config.Database) (store *Store, teardown func(...string))

TestDB returns special test connection and teardown function.

func (*Store) Operation

func (s *Store) Operation() domain.OperationRepository

Operation returns repository, who is responsible for operations.

func (*Store) Resource

func (s *Store) Resource() domain.ResourceRepository

Resource returns repository, who is responsible for resources.

Jump to

Keyboard shortcuts

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