Documentation ¶
Index ¶
- Constants
- func ErrorResponse(code int, msg string, w http.ResponseWriter)
- func ParsePagingParams(page, perPage string, maxPerPage int) (int, int, error)
- func PerItemPagination(_qLimit, _page, _perPage, _numOfSrcs int) ([]int, []int)
- func StartNotifier(in *chan Notification, out ...chan<- Notification)
- func Subscribers() int
- func SupportedAggregate(a string) bool
- func SupportedInterval(i string) bool
- func SupportedType(t string) bool
- func ValidatePagingParams(page, perPage, maxPerPage int) error
- func ValidatePerItemLimit(_qLimit, _perPage, _numOfSrcs int) error
- type Error
- type Notification
- type NotificationType
Constants ¶
View Source
const ( // IDSeparator is used for separation of IDs in the URL IDSeparator = "," // APIVersion defines the API version APIVersion = "0.3.0" // Default MIME type for all responses DefaultMIMEType = "application/vnd.eu.linksmart.hds+json;version=" + APIVersion // Location of APIs RegistryAPILoc = "/registry" DataAPILoc = "/data" AggrAPILoc = "/aggr" // Query parameters ParamPage = "page" ParamPerPage = "per_page" ParamLimit = "limit" ParamStart = "start" ParamEnd = "end" ParamSort = "sort" // Values for ParamSort ASC = "asc" // ascending DESC = "desc" // descending )
View Source
const ( STRING = "string" FLOAT = "float" BOOL = "bool" )
Data source types
Variables ¶
This section is empty.
Functions ¶
func ErrorResponse ¶
func ErrorResponse(code int, msg string, w http.ResponseWriter)
ErrorResponse writes error to HTTP ResponseWriter
func ParsePagingParams ¶
func PerItemPagination ¶
Calculate perItem and offset given the page, perPage, limit, and number of sources
func StartNotifier ¶
func StartNotifier(in *chan Notification, out ...chan<- Notification)
Constructs notifier and starts multicasting
func Subscribers ¶
func Subscribers() int
func SupportedAggregate ¶
func SupportedInterval ¶
func SupportedType ¶
func ValidatePagingParams ¶
func ValidatePerItemLimit ¶
Check if the parameters match the criteria required by PerItemPagination function
Types ¶
type Error ¶
type Error struct { // Code is the (http) code of the error Code int `json:"code"` // Message is the (human-readable) error message Message string `json:"message"` }
Error describes an API error (serializable in JSON)
type Notification ¶
type Notification struct { Type NotificationType Payload interface{} Callback chan error }
A notification message
type NotificationType ¶
type NotificationType uint8
Supported notification types
const ( CREATE NotificationType = iota DELETE UPDATE )
Click to show internal directories.
Click to hide internal directories.