model

package
v0.0.0-...-364f96b Latest Latest
Warning

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

Go to latest
Published: Jul 7, 2019 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SerializedErrorResponse

func SerializedErrorResponse(message string) []byte

Types

type Coordinates

type Coordinates []string

func (Coordinates) Latitude

func (c Coordinates) Latitude() string

func (Coordinates) Longitude

func (c Coordinates) Longitude() string

func (Coordinates) ToString

func (c Coordinates) ToString() string

func (Coordinates) Valid

func (c Coordinates) Valid() bool

TODO Can be improved to return more specific errors

type ErrorResponse

type ErrorResponse struct {
	Error string `json:"error"`
}

type Order

type Order struct {
	ID             uint        `gorm:"primary_key" json:"id"`
	DistanceMeters int         `json:"distance"`
	Status         OrderStatus `json:"status"`
}

type OrderDatabase

type OrderDatabase struct {
	Database *gorm.DB
}

func (OrderDatabase) Create

func (o OrderDatabase) Create(order *Order)

func (OrderDatabase) List

func (o OrderDatabase) List(page int, limit int) []Order

func (OrderDatabase) Migrate

func (o OrderDatabase) Migrate()

func (OrderDatabase) Take

func (o OrderDatabase) Take(orderID uint) error

type OrderStatus

type OrderStatus string
const (
	OrderUnassigned OrderStatus = "UNASSIGNED"
	OrderTaken      OrderStatus = "TAKEN"
)

type OrderStorage

type OrderStorage interface {
	Migrate()
	Create(order *Order)
	Take(orderID uint) error
	List(page int, limit int) []Order
}

Jump to

Keyboard shortcuts

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