model

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: 10 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 ParseBrand added in v0.2.1

func ParseBrand(lexeme string) (other string)

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 {
	CheckSum      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,omitempty"`
	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 {
	OVD           string  `db:"ovd" json:"organunit"`
	Brand         string  `db:"brand" json:"brandmodel"`
	Color         *string `db:"color" json:"color"`
	CarType       *string `db:"car_type" json:"cartype"`
	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:"illegalseizuredate"`
	InsertDate    string  `db:"insert_date" json:"insertdate"`
	CheckSum      string  `db:"check_sum" json:"check_sum"`
}

func (*WantedVehicle) CalculateCheckSum added in v0.2.1

func (w *WantedVehicle) CalculateCheckSum() string

Jump to

Keyboard shortcuts

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