model

package
v0.1.22 Latest Latest
Warning

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

Go to latest
Published: Apr 20, 2020 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// TimeLayout represent time layout for parsing time.
	TimeLayout = "2006-01-02T15:04:05"
)

Variables

This section is empty.

Functions

func ParseKind

func ParseKind(lexeme string) (other string, kind string)

ParseKind splits lexeme into kind and other lexemes.

Example: ParseKind("Tesla - Model X (Легковий автотранспорт)")

=>

other: "Hyundai - i30", kind: "Легковий автотранспорт"

Types

type Revision

type Revision struct {
	ID          string    `json:"id" db:"id"`
	URL         string    `json:"url" db:"url"`
	FileHashSum *string   `json:"file_hash_sum" db:"file_hash_sum"`
	Removed     int       `json:"removed" db:"removed"`
	Added       int       `json:"added" db:"added"`
	CreatedAt   time.Time `json:"created_at" db:"created_at"`
}

Revision represents storage model for revision entity.

func RevisionFromGov

func RevisionFromGov(revision *govdata.Revision) *Revision

func TestRevision

func TestRevision(t *testing.T) *Revision

type RevisionStatMonth

type RevisionStatMonth struct {
	Month   time.Month `db:"month" json:"month"`
	Year    int        `db:"year" json:"year"`
	Added   int        `db:"added" json:"added"`
	Removed int        `db:"removed" json:"removed"`
}

RevisionStatMonth represents revisions aggregate by month.

type Status

type Status string

Status represent status of the vehicle search. Can be either "stolen" or "removed".

const (
	// StatusStolen means, that vehicle was added to the registry.
	StatusStolen Status = "stolen"
	// StatusRemoved means, that vehicle was added, and then removed from the registry.
	StatusRemoved Status = "removed"
)

type Vehicle

type Vehicle struct {
	ID            string    `db:"id" json:"id"`
	Brand         string    `db:"brand" json:"brand"`
	Maker         *string   `db:"maker" json:"maker,omitempty"`
	Model         *string   `db:"model" json:"model,omitempty"`
	Color         *string   `db:"color" json:"color,omitempty"`
	Number        *string   `db:"number" json:"number,omitempty"`
	BodyNumber    *string   `db:"body_number" json:"body_number,omitempty"`
	ChassisNumber *string   `db:"chassis_number" json:"chassis_number,omitempty"`
	EngineNumber  *string   `db:"engine_number" json:"engine_number,omitempty"`
	OVD           string    `db:"ovd" json:"ovd"`
	Kind          string    `db:"kind" json:"kind"`
	Status        Status    `db:"status" json:"status"`
	RevisionID    string    `db:"revision_id" json:"revision_id"`
	TheftDate     string    `db:"theft_date" json:"theft_date"`
	InsertDate    time.Time `db:"insert_date" json:"insert_date"`
}

Vehicle represents storage model for vehicles entity.

func TestVehicle

func TestVehicle(t *testing.T) *Vehicle

func VehicleFromGov

func VehicleFromGov(revision string, vehicle *WantedVehicle) (*Vehicle, error)

func (*Vehicle) BeforeCreate

func (v *Vehicle) BeforeCreate(c *cleansing.Cleansing)

type WantedVehicle

type WantedVehicle struct {
	ID            string  `db:"id" json:"ID"`
	OVD           string  `db:"ovd" json:"OVD"`
	Brand         string  `db:"brand" json:"BRAND"`
	Color         *string `db:"color" json:"COLOR"`
	Number        *string `db:"number" json:"VEHICLENUMBER"`
	BodyNumber    *string `db:"body_number" json:"BODYNUMBER"`
	ChassisNumber *string `db:"chassis_number" json:"CHASSISNUMBER"`
	EngineNumber  *string `db:"engine_number" json:"ENGINENUMBER"`
	TheftDate     string  `db:"theft_date" json:"THEFT_DATA"`
	InsertDate    string  `db:"insert_date" json:"INSERT_DATE"`
}

Jump to

Keyboard shortcuts

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