Documentation
¶
Index ¶
- Constants
- Variables
- func ContentType(format string) string
- func GetAPIContent() *openapi3.Swagger
- func IsParameterReservedName(name string) bool
- func PathCollection(name string) string
- func PathCollectionItems(name string) string
- func PathFormat(url *url.URL) string
- func PathFunction(name string) string
- func PathFunctionItems(name string) string
- func PathItem(name string, fid string) string
- func PathStripFormat(path string) string
- func RequestedFormat(r *http.Request) string
- func URLQuery(url *url.URL) string
- type Bbox
- type CollectionInfo
- type CollectionsInfo
- type Conformance
- type FeatureCollectionRaw
- type FunctionInfo
- type FunctionSummary
- type FunctionsInfo
- type Link
- type NameValMap
- type Parameter
- type Property
- type RequestParam
- type RootInfo
Constants ¶
View Source
const ( RootPageName = "index" TagCollections = "collections" TagItems = "items" TagConformance = "conformance" TagAPI = "api" TagFunctions = "functions" ParamLimit = "limit" ParamOffset = "offset" ParamBbox = "bbox" ParamOrderBy = "orderby" ParamPrecision = "precision" ParamProperties = "properties" ParamTransform = "transform" RelSelf = "self" RelAlt = "alternate" RelData = "data" RelFunctions = "functions" RelItems = "items" TitleFeatuuresGeoJSON = "Features as GeoJSON" TitleDataJSON = "Data as JSON" TitleMetadata = "Metadata" TitleDocument = "This document" TitleAsJSON = " as JSON" TitleAsHTML = " as HTML" GeoJSONFeatureCollection = "FeatureCollection" )
View Source
const ( ErrMsgEncoding = "Error encoding response" ErrMsgLoadCollections = "Unable to access Collections" ErrMsgCollectionNotFound = "Collection not found: %v" ErrMsgCollectionAccess = "Unable to access Collection: %v" ErrMsgFeatureNotFound = "Feature not found: %v" ErrMsgLoadFunctions = "Unable to access Functions" ErrMsgFunctionNotFound = "Function not found: %v" ErrMsgFunctionAccess = "Unable to access Function: %v" ErrMsgInvalidParameterValue = "Invalid value for parameter %v: %v" ErrMsgDataRead = "Unable to read data from: %v" ErrMsgRequestTimeout = "Maximum time exceeded. Request cancelled." )
View Source
const ( ErrCodeCollectionNotFound = "CollectionNotFound" ErrCodeFeatureNotFound = "FeatureNotFound" )
View Source
const ( // ContentTypeJSON tbd ContentTypeJSON = "application/json" // ContentTypeGeoJSON tbd ContentTypeGeoJSON = "application/geo+json" // ContentTypeHTML tbd ContentTypeHTML = "text/html" FormatJSON = "json" FormatHTML = "html" )
Variables ¶
View Source
var BboxSchema openapi3.Schema = openapi3.Schema{ Type: "object", Required: []string{"bbox"}, Properties: map[string]*openapi3.SchemaRef{ "crs": { Value: openapi3.NewStringSchema(), }, "bbox": { Value: &openapi3.Schema{ Type: "array", MinItems: 4, MaxItems: openapi3.Uint64Ptr(4), Items: openapi3.NewSchemaRef("", openapi3.NewFloat64Schema().WithMin(-180).WithMax(180)), }, }, }, }
View Source
var CollectionInfoSchema openapi3.Schema = openapi3.Schema{ Type: "object", Required: []string{"id", "links"}, Properties: map[string]*openapi3.SchemaRef{ "id": {Value: &openapi3.Schema{Type: "string"}}, "title": {Value: &openapi3.Schema{Type: "string"}}, "description": {Value: &openapi3.Schema{Type: "string"}}, "extent": {Value: &BboxSchema}, "crs": {Value: &openapi3.Schema{ Type: "array", Items: &openapi3.SchemaRef{ Value: &openapi3.Schema{Type: "string"}, }, }, }, "geometrytype": {Value: &openapi3.Schema{Type: "string"}}, "properties": {Value: &openapi3.Schema{ Type: "array", Items: &openapi3.SchemaRef{Value: &PropertySchema}, }, }, "links": {Value: &openapi3.Schema{ Type: "array", Items: &openapi3.SchemaRef{Value: &LinkSchema}, }, }, }, }
View Source
var CollectionsInfoSchema openapi3.Schema = openapi3.Schema{ Type: "object", Required: []string{"links", "collections"}, Properties: map[string]*openapi3.SchemaRef{ "links": { Value: &openapi3.Schema{ Type: "array", Items: &openapi3.SchemaRef{ Value: &LinkSchema, }, }, }, "collections": { Value: &openapi3.Schema{ Type: "array", Items: &openapi3.SchemaRef{ Value: &CollectionInfoSchema, }, }, }, }, }
View Source
var ConformanceSchema openapi3.Schema = openapi3.Schema{ Type: "object", Required: []string{"conformsTo"}, Properties: map[string]*openapi3.SchemaRef{ "conformsTo": { Value: &openapi3.Schema{ Type: "array", Items: &openapi3.SchemaRef{ Value: &openapi3.Schema{Type: "string"}, }, }, }, }, }
View Source
var FunctionInfoSchema openapi3.Schema = openapi3.Schema{ Type: "object", Required: []string{"id", "links"}, Properties: map[string]*openapi3.SchemaRef{ "id": {Value: &openapi3.Schema{Type: "string"}}, "description": {Value: &openapi3.Schema{Type: "string"}}, "parameters": {Value: &openapi3.Schema{ Type: "array", Items: &openapi3.SchemaRef{Value: &ParameterSchema}, }, }, "properties": {Value: &openapi3.Schema{ Type: "array", Items: &openapi3.SchemaRef{Value: &PropertySchema}, }, }, "links": {Value: &openapi3.Schema{ Type: "array", Items: &openapi3.SchemaRef{Value: &LinkSchema}, }, }, }, }
View Source
var FunctionSummarySchema openapi3.Schema = openapi3.Schema{ Type: "object", Required: []string{"id", "links"}, Properties: map[string]*openapi3.SchemaRef{ "id": {Value: &openapi3.Schema{Type: "string"}}, "description": {Value: &openapi3.Schema{Type: "string"}}, "links": {Value: &openapi3.Schema{ Type: "array", Items: &openapi3.SchemaRef{Value: &LinkSchema}, }, }, }, }
View Source
var FunctionsInfoSchema openapi3.Schema = openapi3.Schema{ Type: "object", Required: []string{"links", "functions"}, Properties: map[string]*openapi3.SchemaRef{ "links": { Value: &openapi3.Schema{ Type: "array", Items: &openapi3.SchemaRef{Value: &LinkSchema}, }, }, "functions": { Value: &openapi3.Schema{ Type: "array", Items: &openapi3.SchemaRef{Value: &FunctionSummarySchema}, }, }, }, }
View Source
var LinkSchema openapi3.Schema = openapi3.Schema{ Description: "Describes links to other resources", Type: "object", Required: []string{"href"}, Properties: map[string]*openapi3.SchemaRef{ "href": {Value: &openapi3.Schema{Type: "string", Description: "URL for the link"}}, "rel": {Value: &openapi3.Schema{Type: "string"}}, "type": {Value: &openapi3.Schema{Type: "string"}}, "hreflang": {Value: &openapi3.Schema{Type: "string"}}, "title": {Value: &openapi3.Schema{Type: "string"}}, }, }
View Source
var ParamReservedNames = []string{ ParamLimit, ParamOffset, ParamBbox, ParamOrderBy, ParamPrecision, ParamProperties, ParamTransform, }
View Source
var ParamReservedNamesMap = makeSet(ParamReservedNames)
View Source
var ParameterSchema openapi3.Schema = openapi3.Schema{ Description: "A parameter of a function", Type: "object", Required: []string{"name", "type"}, Properties: map[string]*openapi3.SchemaRef{ "name": {Value: &openapi3.Schema{Type: "string"}}, "type": {Value: &openapi3.Schema{Type: "string"}}, "default": {Value: &openapi3.Schema{Type: "string"}}, }, }
View Source
var PropertySchema openapi3.Schema = openapi3.Schema{ Description: "A data property of a collection or function result", Type: "object", Required: []string{"name", "type"}, Properties: map[string]*openapi3.SchemaRef{ "name": {Value: &openapi3.Schema{Type: "string"}}, "type": {Value: &openapi3.Schema{Type: "string"}}, "description": {Value: &openapi3.Schema{Type: "string"}}, }, }
View Source
var RootInfoSchema openapi3.Schema = openapi3.Schema{ Type: "object", Required: []string{"links"}, Properties: map[string]*openapi3.SchemaRef{ "title": {Value: &openapi3.Schema{ Type: "string", Description: "Title of this feature service", }}, "description": {Value: &openapi3.Schema{ Type: "string", Description: "Description of this feature service", }}, "links": { Value: &openapi3.Schema{ Type: "array", Items: &openapi3.SchemaRef{Value: &LinkSchema}, }, }, }, }
Functions ¶
func GetAPIContent ¶
func IsParameterReservedName ¶ added in v1.1.0
func PathCollection ¶
func PathCollectionItems ¶
func PathFormat ¶
func PathFunction ¶
func PathFunctionItems ¶
func PathStripFormat ¶
func RequestedFormat ¶
Types ¶
type CollectionInfo ¶
type CollectionInfo struct {
Name string `json:"id"`
Title string `json:"title,omitempty"`
Description string `json:"description,omitempty"`
Extent *Bbox `json:"extent,omitempty"`
Crs []string `json:"crs,omitempty"`
GeometryType *string `json:"geometrytype,omitempty"`
// these are omitempty so they don't show in summary metadata
Properties []*Property `json:"properties,omitempty"`
Links []*Link `json:"links"`
// used for HTML response only
URLMetadataHTML string `json:"-"`
URLMetadataJSON string `json:"-"`
URLItemsHTML string `json:"-"`
URLItemsJSON string `json:"-"`
}
CollectionInfo for a collection
func NewCollectionInfo ¶
func NewCollectionInfo(tbl *data.Table) *CollectionInfo
type CollectionsInfo ¶
type CollectionsInfo struct {
Links []*Link `json:"links"`
Collections []*CollectionInfo `json:"collections"`
}
CollectionsInfo for all collections
func NewCollectionsInfo ¶
func NewCollectionsInfo(tables []*data.Table) *CollectionsInfo
type Conformance ¶
type Conformance struct {
ConformsTo []string `json:"conformsTo"`
}
func GetConformance ¶
func GetConformance() *Conformance
type FeatureCollectionRaw ¶
type FeatureCollectionRaw struct {
Type string `json:"type"`
Features []*json.RawMessage `json:"features"`
NumberMatched uint `json:"numberMatched,omitempty"`
NumberReturned uint `json:"numberReturned"`
TimeStamp string `json:"timeStamp,omitempty"`
Links []*Link `json:"links"`
}
FeatureCollection info
func NewFeatureCollectionInfo ¶
func NewFeatureCollectionInfo(featureJSON []string) *FeatureCollectionRaw
type FunctionInfo ¶
type FunctionInfo struct {
Name string `json:"id"`
Description string `json:"description,omitempty"`
// these properties are always present but may be empty arrays
Parameters []*Parameter `json:"parameters"`
Properties []*Property `json:"properties"`
Links []*Link `json:"links"`
//--- additional data used during processing
Function *data.Function `json:"-"`
}
FunctionInfo is the API metadata for a function
func NewFunctionInfo ¶
func NewFunctionInfo(fn *data.Function) *FunctionInfo
type FunctionSummary ¶ added in v1.1.0
type FunctionSummary struct {
Name string `json:"id"`
Description string `json:"description,omitempty"`
Links []*Link `json:"links"`
//--- additional data used during processing
Function *data.Function `json:"-"`
// used for HTML response only
URLMetadataHTML string `json:"-"`
URLMetadataJSON string `json:"-"`
URLItemsHTML string `json:"-"`
URLItemsJSON string `json:"-"`
}
FunctionSummary contains a restricted set of function metadata for use in list display and JSON This allows not including parameters and properties in list metadata, but ensuring those keys are always present in full metadata JSON. Note: Collections do not follow same pattern because their list JSON metadata is supposed to contain all properties, and they are always expected to have attribute properties
func NewFunctionSummary ¶ added in v1.1.0
func NewFunctionSummary(fn *data.Function) *FunctionSummary
type FunctionsInfo ¶
type FunctionsInfo struct {
Links []*Link `json:"links"`
Functions []*FunctionSummary `json:"functions"`
}
FunctionsInfo is the API metadata for all functions
func NewFunctionsInfo ¶
func NewFunctionsInfo(fns []*data.Function) *FunctionsInfo
type Link ¶
type Link struct {
Href string `json:"href"`
Rel string `json:"rel"`
Type string `json:"type"`
Title string `json:"title"`
}
Link for links
type NameValMap ¶
type Parameter ¶
type Parameter struct {
Name string `json:"name"`
Type string `json:"type"`
Description string `json:"description"`
Default string `json:"default,omitempty"`
}
func FunctionParameters ¶
type Property ¶
type Property struct {
Name string `json:"name"`
Type string `json:"type"`
Description string `json:"description"`
}
func FunctionProperties ¶
func TableProperties ¶
type RequestParam ¶
type RequestParam struct {
Limit int
Offset int
Bbox *data.Extent
Properties []string
OrderBy []data.Ordering
Precision int
TransformFuns []data.TransformFunction
Values NameValMap
}
RequestParam holds the parameters for a request
Click to show internal directories.
Click to hide internal directories.