models

package
v0.0.0-...-2c5aaa4 Latest Latest
Warning

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

Go to latest
Published: Oct 5, 2016 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func StrfmtDateTimeToTime

func StrfmtDateTimeToTime(date *strfmt.DateTime) time.Time

Types

type Item

type Item struct {

	/* description

	Max Length: 2048
	Min Length: 1
	*/
	Description string `json:"description,omitempty"`

	/* id

	Read Only: true
	*/
	ID int64 `json:"id,omitempty"`

	/* name of the thing in the lab reserved

	Required: true
	Max Length: 512
	Min Length: 1
	*/
	Name *string `json:"name"`

	/* ordered list of reservations
	 */
	Reservations []*Reservation `json:"reservations,omitempty"`
}

Item item

swagger:model item

func NewItem

func NewItem(name string, description string) Item

func (*Item) Reserve

func (item *Item) Reserve(owner string, starttime time.Time, endtime time.Time) bool

func (Item) String

func (item Item) String() string

func (*Item) Validate

func (m *Item) Validate(formats strfmt.Registry) error

Validate validates this item

type Items

type Items map[string]Item

Items map of items

swagger:model items

func NewItems

func NewItems() Items

func (*Items) LoadJSON

func (items *Items) LoadJSON(s string) error

Load items from JSON. clobbers current Items

func (Items) Store

func (items Items) Store(filename string) error

Store all the items as JSON in a file

func (Items) String

func (items Items) String() string

returns JSON string

func (Items) Validate

func (m Items) Validate(formats strfmt.Registry) error

Validate validates this items

type Reservation

type Reservation struct {

	/* approved or not

	Required: true
	*/
	Approved *bool `json:"approved"`

	/* date-time the reservation begins

	Required: true
	*/
	Begin *strfmt.DateTime `json:"begin"`

	/* date-time the reservation ends

	Required: true
	*/
	End *strfmt.DateTime `json:"end"`

	/* user claiming the reservation

	Required: true
	*/
	Username *string `json:"username"`
}

Reservation date-time marking start of reservation, duration, and owner of the reservation

swagger:model reservation

func NewReservation

func NewReservation(username string, begin time.Time, end time.Time) Reservation

func (Reservation) GetEndTime

func (r Reservation) GetEndTime() (error, time.Time)

func (Reservation) GetTime

func (r Reservation) GetTime() (error, time.Time)

returns a zero time on error

func (Reservation) Overlap

func (r Reservation) Overlap(other Reservation) (error, bool)

func (Reservation) ReservedAt

func (r Reservation) ReservedAt(time time.Time) (error, bool)

func (Reservation) String

func (r Reservation) String() string

func (*Reservation) Validate

func (m *Reservation) Validate(formats strfmt.Registry) error

Validate validates this reservation

type User

type User struct {

	/* user contact email

	Required: true
	*/
	Email *strfmt.Email `json:"email"`

	/* id

	Read Only: true
	*/
	ID int64 `json:"id,omitempty"`

	/* reservation user's name

	Required: true
	Max Length: 512
	Min Length: 1
	*/
	Name *string `json:"name"`
}

User user

swagger:model user

func NewUser

func NewUser(name string, email string) User

func (User) Store

func (user User) Store(filename string) error

Store all the items as JSON in a file

func (User) String

func (user User) String() string

func (*User) Validate

func (m *User) Validate(formats strfmt.Registry) error

Validate validates this user

type Users

type Users map[string]User

Users map of users

swagger:model users

func NewUsers

func NewUsers() Users

func (Users) Store

func (users Users) Store(filename string) error

Store all the users as JSON in a file

func (Users) String

func (users Users) String() string

func (Users) Validate

func (m Users) Validate(formats strfmt.Registry) error

Validate validates this users

Jump to

Keyboard shortcuts

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