models

package
v0.0.0-...-d1a64ea Latest Latest
Warning

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

Go to latest
Published: May 22, 2016 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ParkStatusOffline = iota
	ParkStatusOnline  = iota
)

Constants describing the status of a parking lot

Variables

This section is empty.

Functions

This section is empty.

Types

type Park

type Park struct {
	ID        bson.ObjectId `json:"id"`
	AppUserID bson.ObjectId `json:"appUserID"`
	Address   string        `json:"address"`
	Status    int           `json:"status"`
	Position  Point         `json:"position"`
	Slots     []Slot        `json:"slots"`
}

Park represents an entire parking lot, which has one or more slots in which cars are parked

func (*Park) Collapse

func (park *Park) Collapse() *dbmodels.Park

Collapse coppies the Park to a dbmodels.Park user and only keeps the unique identifiers from the inner components

func (*Park) Expand

func (park *Park) Expand(dbPark dbmodels.Park)

Expand copies the dbmodels.Park to a Park expands all the components by fetching them from the database

type Point

type Point struct {
	X float64 `json:"x"`
	Y float64 `json:"y"`
}

Point contains the left-upper and bottom-lower points of a rectangle in which an entire zone is located

func (*Point) Collapse

func (point *Point) Collapse() *dbmodels.Point

Collapse coppies the Point to a dbmodels.Point and only keeps the unique identifiers from the inner components

func (*Point) Expand

func (point *Point) Expand(dbPoint dbmodels.Point)

Expand copies the dbmodels.Point to a Point expands all the components by fetching them from the database

type Slot

type Slot struct {
	ID         bson.ObjectId `json:"id"`
	Park       Park          `json:"park"`
	Position   Point         `json:"position"`
	IsOccupied bool          `json:"isOccupied"`
}

Slot reprents a square in a parking lot, where the car is parked

func (*Slot) Collapse

func (slot *Slot) Collapse() *dbmodels.Slot

Collapse coppies the Slot to a dbmodels.Slot user and only keeps the unique identifiers from the inner components

func (*Slot) Expand

func (slot *Slot) Expand(dbSlot dbmodels.Slot)

Expand copies the dbmodels.Slot to a Slot expands all the components by fetching them from the database

Jump to

Keyboard shortcuts

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