datasources

package
v0.46.0 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Datasource

type Datasource interface {

	// GetFeatureIDs returns all IDs of Features matching the given criteria, as well as Cursors for pagination.
	// To be used in concert with GetFeaturesByID
	GetFeatureIDs(ctx context.Context, collection string, criteria FeaturesCriteria) ([]int64, domain.Cursors, error)

	// GetFeaturesByID returns a collection of Features with the given IDs. To be used in concert with GetFeatureIDs
	GetFeaturesByID(ctx context.Context, collection string, featureIDs []int64) (*domain.FeatureCollection, error)

	// GetFeatures returns all Features matching the given criteria and Cursors for pagination
	GetFeatures(ctx context.Context, collection string, criteria FeaturesCriteria) (*domain.FeatureCollection, domain.Cursors, error)

	// GetFeature returns a specific Feature
	GetFeature(ctx context.Context, collection string, featureID int64) (*domain.Feature, error)

	// GetFeatureTableMetadata returns metadata about a feature table associated with the given collection
	GetFeatureTableMetadata(collection string) (FeatureTableMetadata, error)

	// Close closes (connections to) the datasource gracefully
	Close()
}

Datasource holds all Features for a single object type in a specific projection.

type FeatureTableMetadata

type FeatureTableMetadata interface {

	// ColumnsWithDataType returns a mapping from column names to column data types.
	// Note: data types can be datasource specific.
	ColumnsWithDataType() map[string]string
}

FeatureTableMetadata abstraction to access metadata of a feature table (aka attribute table)

type FeaturesCriteria

type FeaturesCriteria struct {
	// pagination
	Cursor domain.DecodedCursor
	Limit  int

	// multiple projections support
	InputSRID  int // derived from bbox or filter param when available, or WGS84 as default
	OutputSRID int // derived from crs param when available, or WGS84 as default

	// filtering by bounding box
	Bbox *geom.Extent

	// filtering by reference date
	TemporalCriteria TemporalCriteria

	// filtering by properties
	PropertyFilters map[string]string

	// filtering by CQL
	Filter     string
	FilterLang string
}

FeaturesCriteria to select a certain set of Features

type SQLLog

type SQLLog struct {
	LogSQL        bool
	SlowQueryTime time.Duration
}

SQLLog query logging for debugging purposes

func NewSQLLogFromEnv

func NewSQLLogFromEnv() *SQLLog

NewSQLLogFromEnv build a SQLLog from environment variables listed in this file

func (*SQLLog) After

func (s *SQLLog) After(ctx context.Context, query string, args ...any) (context.Context, error)

After callback once execution of the given SQL query is done

func (*SQLLog) Before

func (s *SQLLog) Before(ctx context.Context, _ string, _ ...any) (context.Context, error)

Before callback prior to execution of the given SQL query

type TemporalCriteria

type TemporalCriteria struct {
	// reference date
	ReferenceDate time.Time

	// startDate and endDate properties
	StartDateProperty string
	EndDateProperty   string
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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