data

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Dec 1, 2020 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	JSONTypeString  = "string"
	JSONTypeNumber  = "number"
	JSONTypeBoolean = "boolean"

	PGTypeBool     = "bool"
	PGTypeNumeric  = "numeric"
	PGTypeGeometry = "geometry"
)
View Source
const FunctionIDColumnName = "id"

FunctionIDColumnName is the name for a function-supplied ID

Variables

This section is empty.

Functions

This section is empty.

Types

type Catalog

type Catalog interface {
	Tables() ([]*Table, error)

	// TableByName returns the table with given name.
	// It returns nil if the table does not exist
	TableByName(name string) (*Table, error)

	// TableFeatures returns an array of the JSON for the features in a table
	// It returns nil if the table does not exist
	TableFeatures(ctx context.Context, name string, param *QueryParam) ([]string, error)

	// TableFeature returns the JSON text for a table feature with given id
	// It returns an empty string if the table or feature does not exist
	TableFeature(ctx context.Context, name string, id string, param *QueryParam) (string, error)

	Functions() ([]*Function, error)

	// FunctionByName returns the function with given name.
	// It returns nil if the function does not exist
	FunctionByName(name string) (*Function, error)

	FunctionFeatures(ctx context.Context, name string, args map[string]string, param *QueryParam) ([]string, error)

	FunctionData(ctx context.Context, name string, args map[string]string, param *QueryParam) ([]map[string]interface{}, error)

	Close()
}

Catalog tbd

func CatDBInstance

func CatDBInstance() Catalog

CatDBInstance tbd

type CatalogMock

type CatalogMock struct {
	TableDefs []*Table

	FunctionDefs []*Function
	// contains filtered or unexported fields
}

func CatMockInstance

func CatMockInstance() *CatalogMock

CatMockInstance tbd

func (*CatalogMock) Close

func (cat *CatalogMock) Close()

func (*CatalogMock) FunctionByName

func (cat *CatalogMock) FunctionByName(name string) (*Function, error)

func (*CatalogMock) FunctionData

func (cat *CatalogMock) FunctionData(ctx context.Context, name string, args map[string]string, param *QueryParam) ([]map[string]interface{}, error)

func (*CatalogMock) FunctionFeatures

func (cat *CatalogMock) FunctionFeatures(ctx context.Context, name string, args map[string]string, param *QueryParam) ([]string, error)

func (*CatalogMock) Functions

func (cat *CatalogMock) Functions() ([]*Function, error)

func (*CatalogMock) TableByName

func (cat *CatalogMock) TableByName(name string) (*Table, error)

func (*CatalogMock) TableFeature

func (cat *CatalogMock) TableFeature(ctx context.Context, name string, id string, param *QueryParam) (string, error)

func (*CatalogMock) TableFeatures

func (cat *CatalogMock) TableFeatures(ctx context.Context, name string, param *QueryParam) ([]string, error)

func (*CatalogMock) Tables

func (cat *CatalogMock) Tables() ([]*Table, error)

type Extent

type Extent struct {
	Minx, Miny, Maxx, Maxy float64
}

Extent of a table

type FilterCond added in v1.1.0

type FilterCond struct {
	Name  string
	Value string
}

type Function

type Function struct {
	ID             string
	Schema         string
	Name           string
	Description    string
	InNames        []string
	InDbTypes      []string
	InTypeMap      map[string]string
	InDefaults     []string
	NumNoDefault   int
	OutNames       []string
	OutDbTypes     []string
	OutJSONTypes   []string
	Types          map[string]string
	GeometryColumn string
	IDColumn       string
}

Function tbd

func (*Function) IsGeometryFunction

func (fun *Function) IsGeometryFunction() bool

type Ordering

type Ordering struct {
	Name   string
	IsDesc bool // false = ASC (default), true = DESC
}

type QueryParam

type QueryParam struct {
	Limit  int
	Offset int
	Bbox   *Extent
	Filter []*FilterCond
	// Columns is the list of columns to return
	Columns       []string
	OrderBy       []Ordering
	Precision     int
	TransformFuns []TransformFunction
}

QueryParam holds the optional parameters for a data query

type Table

type Table struct {
	ID             string
	Schema         string
	Table          string
	Title          string
	Description    string
	GeometryType   string
	GeometryColumn string
	IDColumn       string
	Srid           int
	Extent         Extent
	Columns        []string
	DbTypes        map[string]string
	JSONTypes      []string
	ColDesc        []string
}

Table holds metadata for table/view objects

type TransformFunction

type TransformFunction struct {
	Name string
	Arg  []string
}

TransformFunction denotes a geometry function with arguments

Jump to

Keyboard shortcuts

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