db

package
v0.0.0-...-5dea150 Latest Latest
Warning

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

Go to latest
Published: May 6, 2020 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNotFound = errors.New("The requested document was not found")

ErrNotFound is the error returned by the package when a document is not found to fulfill a request

Functions

func DBSearch

func DBSearch(url, method string, query, resp interface{}) error

func GetState

func GetState(url, method string, responseBody interface{}) error

Types

type Device

type Device struct {
	ID     string            `json:"_id"`
	TypeID string            `json:"typeID"`
	Tags   map[string]string `json:"tags"`
}

type DeviceResponse

type DeviceResponse struct {
	Docs     []Device `json:"docs"`
	Bookmark string   `json:"bookmark"`
	Warning  string   `json:"warning"`
}

type DeviceType

type DeviceType struct {
	ID   string            `json:"_id"`
	Tags map[string]string `json:"tags"`
}

type Room

type Room struct {
	Rev  string            `json:"_rev,omitempty"`
	ID   string            `json:"_id"`
	Tags map[string]string `json:"tags"`
}

type RoomResponse

type RoomResponse struct {
	Docs     []Room `json:"docs"`
	Bookmark string `json:"bookmark"`
	Warning  string `json:"warning"`
}

Rooms

type Service

type Service struct {
	Address  string
	Username string
	Password string
}

Service represents a database service and the config necessary to run the service

func (*Service) GetDeviceByID

func (s *Service) GetDeviceByID(deviceID string) (*Device, error)

GetDevicebyID gets a device document from couch given the id

func (*Service) GetDeviceTypeByID

func (s *Service) GetDeviceTypeByID(deviceTypeID string) (*DeviceType, error)

GetDeviceTypeByID returns the device type document for the given id

func (*Service) GetDevicesByRoom

func (s *Service) GetDevicesByRoom(roomID string) ([]Device, error)

GetDevicesByRoom returns an array of devices that are a part of the given room

func (*Service) GetRoomByID

func (s *Service) GetRoomByID(roomID string) (*Room, error)

GetRoomByID returns the Room document for the given roomID

Jump to

Keyboard shortcuts

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