sqlstore

package
v0.1.36 Latest Latest
Warning

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

Go to latest
Published: Jan 16, 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 Registration added in v0.1.18

type Registration struct {
	Brand        *string  `db:"brand"`
	Capacity     *int     `db:"capacity"`
	Color        string   `db:"color"`
	FirstRegDate *string  `db:"d_first_reg"`
	Date         *string  `db:"d_reg"`
	Fuel         *string  `db:"fuel"`
	Kind         *string  `db:"kind"`
	Year         int      `db:"make_year"`
	Model        *string  `db:"model"`
	NDoc         string   `db:"n_doc"`
	SDoc         string   `db:"s_doc"`
	Code         string   `db:"code"`
	Number       string   `db:"n_reg_new"`
	NumSeating   *int     `db:"n_seating"`
	NumStanding  *int     `db:"n_standing"`
	OwnWeight    *float64 `db:"own_weight"`
	RankCategory *string  `db:"rank_category"`
	TotalWeight  *float64 `db:"total_weight"`
	VIN          *string  `db:"vin"`
}

type RegistrationStore added in v0.1.18

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

Store is postgres wrapper for store.Store.

func New

func New(conf *config.Database) (*RegistrationStore, error)

New returns new instance of store.

func TestDB

func TestDB(t *testing.T, conf *config.Database) (*RegistrationStore, func(...string))

TestDB returns special test connection and teardown function.

func (*RegistrationStore) AllSeries added in v0.1.18

func (s *RegistrationStore) AllSeries(ctx context.Context) ([]string, error)

AllSeries returns list of all known series.

func (*RegistrationStore) Create added in v0.1.18

func (s *RegistrationStore) Create(ctx context.Context, registration *model.Registration) error

Create adds new record to the database.

func (*RegistrationStore) FindByCode added in v0.1.18

func (s *RegistrationStore) FindByCode(ctx context.Context, code string) (*model.Registration, error)

FindByCode returns registrations with specified code.

func (*RegistrationStore) FindByNumber added in v0.1.18

func (s *RegistrationStore) FindByNumber(ctx context.Context, number string) ([]model.Registration, error)

FindByNumber returns registrations with specified number.

func (*RegistrationStore) FindByVIN added in v0.1.18

func (s *RegistrationStore) FindByVIN(ctx context.Context, vin string) ([]model.Registration, error)

FindByVIN returns registrations with specified VIN.

func (*RegistrationStore) FindLastBySeries added in v0.1.18

func (s *RegistrationStore) FindLastBySeries(ctx context.Context, series string) (*model.Registration, error)

GetLast returns last registration from the database.

func (*RegistrationStore) Health added in v0.1.18

func (s *RegistrationStore) Health(ctx context.Context) error

Jump to

Keyboard shortcuts

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