models

package
v0.0.0-...-a18ff84 Latest Latest
Warning

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

Go to latest
Published: May 11, 2019 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrMissingRequiredParameters reqd parameter missing
	ErrMissingRequiredParameters = errors.New("missing required parameter")
	// ErrRecordsNotFound list is empty
	ErrRecordsNotFound = errors.New("record(s) not found")
	// ErrRecordNotFound data not exiss
	ErrRecordNotFound = errors.New("record not found")
	// ErrRecordMismatch generated hashkey by name is a mismatch
	ErrRecordMismatch = errors.New("record id/name mismatch")
	// ErrRecordExists data already exiss
	ErrRecordExists = errors.New("record exists")
	// ErrDBTransaction internal storage error
	ErrDBTransaction = errors.New("db storage failed")
)

Functions

This section is empty.

Types

type BuildingCreateParams

type BuildingCreateParams struct {
	Name    *string  `json:"name"`
	Address string   `json:"address"`
	Floors  []string `json:"floors"`
}

BuildingCreateParams create parameter

func NewBuildingCreate

func NewBuildingCreate() *BuildingCreateParams

NewBuildingCreate new creator

func (*BuildingCreateParams) Bind

func (p *BuildingCreateParams) Bind(r *http.Request) error

Bind filter parameter

func (*BuildingCreateParams) Create

func (p *BuildingCreateParams) Create(store *drivers.Storage) (string, error)

Create add a row from the store

func (*BuildingCreateParams) SanityCheck

func (p *BuildingCreateParams) SanityCheck() error

SanityCheck filter required parameter

type BuildingData

type BuildingData struct {
	ID       string   `json:"id"`
	Name     string   `json:"name"`
	Address  string   `json:"address,omitempty"`
	Floors   []string `json:"floors,omitempty"`
	Created  string   `json:"created,omitempty"`
	Modified string   `json:"modified,omitempty"`
}

BuildingData data row in the storage

func NewBuildingData

func NewBuildingData() *BuildingData

NewBuildingData new instance

func (BuildingData) HashKey

func (q BuildingData) HashKey(s string) string

HashKey convert to md5 hash

type BuildingDeleteParams

type BuildingDeleteParams struct {
	ID string `json:"id"`
}

BuildingDeleteParams delete parameter

func NewBuildingDelete

func NewBuildingDelete(pid string) *BuildingDeleteParams

NewBuildingDelete new instance

func (*BuildingDeleteParams) Delete

func (p *BuildingDeleteParams) Delete(store *drivers.Storage) error

Delete remove a row from the store base on id

type BuildingGetParams

type BuildingGetParams struct {
	ID string `json:"id"`
}

BuildingGetParams get parameter

func NewBuildingGetOne

func NewBuildingGetOne(id string) *BuildingGetParams

NewBuildingGetOne new instance with parameter

func (*BuildingGetParams) Get

func (p *BuildingGetParams) Get(store *drivers.Storage) (*BuildingData, error)

Get query from the store base on id

func (*BuildingGetParams) GetAll

func (p *BuildingGetParams) GetAll(store *drivers.Storage) ([]*BuildingData, error)

GetAll query from the store base on id

type BuildingUpdateParams

type BuildingUpdateParams struct {
	ID *string `json:"id"`
	BuildingCreateParams
}

BuildingUpdateParams update parameter

func NewBuildingUpdate

func NewBuildingUpdate() *BuildingUpdateParams

NewBuildingUpdate new instance

func (*BuildingUpdateParams) Bind

func (p *BuildingUpdateParams) Bind(r *http.Request) error

Bind filter parameter

func (*BuildingUpdateParams) SanityCheck

func (p *BuildingUpdateParams) SanityCheck() error

SanityCheck filter required parameter

func (*BuildingUpdateParams) Update

func (p *BuildingUpdateParams) Update(store *drivers.Storage) error

Update a row from the store

Jump to

Keyboard shortcuts

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