store

package
v0.2.5 Latest Latest
Warning

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

Go to latest
Published: Nov 3, 2020 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrRecordNotFound = errors.New("record not found")
)

Functions

This section is empty.

Types

type RevisionRepository

type RevisionRepository interface {
	Create(revision *model.Revision) error
	FindByID(id string) (*model.Revision, error)
	Last() (*model.Revision, error)
	All() ([]model.Revision, error)
	AllWithLimit(limit uint64) ([]model.Revision, error)
	AllIDs() ([]string, error)
	Stats() ([]model.RevisionStatMonth, error)
}

type Store

type Store interface {
	Revision() RevisionRepository
	Vehicle() VehicleRepository
}

type Transport

type Transport []model.Vehicle

Transport is a wrapper for slice of WantedVehicle.

func (Transport) Len

func (t Transport) Len() int

Len is the number of elements in the collection.

func (Transport) Less

func (t Transport) Less(i, j int) bool

Less reports whether the element with index i should sort before the element with index j.

func (Transport) Search

func (t Transport) Search(id string) int

Search returns id of element, which has specified ID. Transport array should be pre-sorted.

Uses binary-search algorithm under the hood. More about algorithm: https://en.wikipedia.org/wiki/Binary_search_algorithm.

func (Transport) Swap

func (t Transport) Swap(i, j int)

Swap swaps the elements with indexes i and j.

type VehicleRepository

type VehicleRepository interface {
	Create(revision *model.Revision, added []model.Vehicle, removed []string) error
	FindByNumber(number string) ([]model.Vehicle, error)
	FindByVIN(vin string) ([]model.Vehicle, error)
	FindByRevisionID(id string) ([]model.Vehicle, error)
	All() ([]model.Vehicle, error)
	AllWithLimit(limit uint64) ([]model.Vehicle, error)
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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