config

package
v0.0.0-...-68ec166 Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2017 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewFeatureID

func NewFeatureID(id interface{}) interface{}

Types

type Body

type Body []BodyElement

Body list of BodyElements. JSON response object.

type BodyElement

type BodyElement map[string]interface{}

BodyElement is a type which is a part of JSON response

type Config

type Config struct {
	Server  ServerConf
	Workers []*WorkerConf
}

Config application configuration structure

func ReadConf

func ReadConf(filePath string) (conf *Config, err error)

ReadConf reads and decodes JSON from file

func (Config) GetFeaturesDef

func (c Config) GetFeaturesDef(name string) *FeatureConf

GetFeaturesDef returns Protocol definition of nil if not found

func (Config) GetWorkerDef

func (c Config) GetWorkerDef(name string) *WorkerConf

GetWorkerDef returns worker connection definition of nil if not found

type DumpRequest

type DumpRequest struct {
	Dataset           string
	Collection        string
	IDFieldName       string
	IDFieldtype       string
	GeometryFieldName string
	GeometryFieldType string
	Fields            []*FieldConf
	BBox              []float32
	Limit             int
}

DumpRequest struct

func NewDumpRequest

func NewDumpRequest(featureConf *FeatureConf, bb []float32, limit int) *DumpRequest

NewDumpRequest creates new instance of FeaturesRequest

type FeatureConf

type FeatureConf struct {
	Name        string       `json:"name"`
	DisplayName string       `json:"display_name"`
	Dataset     string       `json:"dataset"`
	MinZoom     int          `json:"min_zoom"`
	MaxZoom     int          `json:"max_zoom"`
	Fields      []*FieldConf `json:"fields"`
}

FeatureConf is a definition of protocol. Contains name, list of entry parameters and list of results fields

func (FeatureConf) FieldsWithoutID

func (f FeatureConf) FieldsWithoutID() (fields []*FieldConf)

FieldsWithoutID return list of fields except the key field

func (FeatureConf) GetField

func (f FeatureConf) GetField(name string) (field *FieldConf)

GetField return field configuration with name

func (FeatureConf) GetGeomField

func (f FeatureConf) GetGeomField() *FieldConf

GetGeomField return primary key field name

func (FeatureConf) GetIDField

func (f FeatureConf) GetIDField() *FieldConf

GetIDField return primary key field name

type FeatureID

type FeatureID interface{}

FeatureID id of feature

type FeatureRequest

type FeatureRequest struct {
	Dataset      string
	Collection   string
	IDFieldName  string
	IDFieldValue FeatureID
	IDFieldType  string
	Fields       []*FieldConf
}

FeatureRequest struct

func NewFeatureRequest

func NewFeatureRequest(featureConf *FeatureConf, id string) (*FeatureRequest, error)

NewFeatureRequest creates new instance of FeatureRequest

func (*FeatureRequest) GetIDFieldName

func (r *FeatureRequest) GetIDFieldName() string

GetIDFieldName returns name of id field

type FeaturesRequest

type FeaturesRequest struct {
	Dataset           string
	Collection        string
	IDFieldName       string
	IDFieldtype       string
	GeometryFieldName string
	GeometryFieldType string
	BBox              []float32
	Limit             int
}

FeaturesRequest struct

func NewFeaturesRequest

func NewFeaturesRequest(featureConf *FeatureConf, bb []float32, limit int) *FeaturesRequest

NewFeaturesRequest creates new instance of FeaturesRequest

func (*FeaturesRequest) GetIDFieldName

func (r *FeaturesRequest) GetIDFieldName() string

GetIDFieldName returns name of id field

type FeaturesResponse

type FeaturesResponse struct {
	Body  *geojson.FeatureCollection
	Error error
}

FeaturesResponse struct Body - result map (field, value) to json

func (*FeaturesResponse) GetBody

func (r *FeaturesResponse) GetBody() interface{}

GetBody return response body

func (*FeaturesResponse) GetError

func (r *FeaturesResponse) GetError() error

GetError return response error

func (*FeaturesResponse) SetBody

func (r *FeaturesResponse) SetBody(body interface{})

SetBody set response body

func (*FeaturesResponse) SetError

func (r *FeaturesResponse) SetError(err error)

SetError set response error

type FieldConf

type FieldConf struct {
	Name        string `json:"name"`
	DisplayName string `json:"display_name"`
	Type        string `json:"type"`
	Key         bool   `json:"key"`
	Searchable  bool   `json:"searchable"`
	Geometry    bool   `json:"geom"`
}

FieldConf is parameter name and type definition. Type could take values string, unsigned_int, signed_int, etc

type Request

type Request interface {
	GetIDFieldName() string
}

Request interface

type SearchRequest

type SearchRequest struct {
	Datset            string
	Collection        string
	SearchFiledName   string
	SearchFiledType   string
	IDFieldName       string
	SearchFiledValues []string
}

SearchRequest for search feature

func NewSearchRequest

func NewSearchRequest(featureConf *FeatureConf, name, fieldType string, values []string) *SearchRequest

NewSearchRequest return new search request

func (*SearchRequest) GetIDFieldName

func (r *SearchRequest) GetIDFieldName() string

GetIDFieldName returns name of id field

type ServerConf

type ServerConf struct {
	Port     int
	Center   []float32
	Features []*FeatureConf
}

ServerConf server configuration

type WorkMode

type WorkMode int

WorkMode - enumerator with server mode types

const (
	// Version number
	Version = "0.9"
	// UnknownMode is unrecognized mode
	UnknownMode WorkMode = iota
	// NormalMode is production mode
	NormalMode
	// TestMode  to test communication between Acp and worker
	TestMode
)

type WorkerConf

type WorkerConf struct {
	Host string
	Name string
	Port int
}

WorkerConf workers configuration

Jump to

Keyboard shortcuts

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