postgis

package
v0.8.1 Latest Latest
Warning

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

Go to latest
Published: Jun 13, 2019 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Overview

Package postgis implements the database interfaces for PostGIS.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(conf database.Config, m *config.Mapping) (database.DB, error)

Types

type ColumnSpec

type ColumnSpec struct {
	Name      string
	FieldType mapping.ColumnType
	Type      ColumnType
}

func (*ColumnSpec) AsSQL

func (col *ColumnSpec) AsSQL() string

type ColumnType

type ColumnType interface {
	Name() string
	PrepareInsertSQL(i int,
		spec *TableSpec) string
	GeneralizeSQL(colSpec *ColumnSpec, spec *GeneralizedTableSpec) string
}

type GeneralizedTableSpec

type GeneralizedTableSpec struct {
	Name              string
	FullName          string
	Schema            string
	SourceName        string
	Source            *TableSpec
	SourceGeneralized *GeneralizedTableSpec
	Tolerance         float64
	Where             string

	Generalizations []*GeneralizedTableSpec
	// contains filtered or unexported fields
}

func NewGeneralizedTableSpec

func NewGeneralizedTableSpec(pg *PostGIS, t *config.GeneralizedTable) *GeneralizedTableSpec

func (*GeneralizedTableSpec) DeleteSQL

func (spec *GeneralizedTableSpec) DeleteSQL() string

func (*GeneralizedTableSpec) InsertSQL

func (spec *GeneralizedTableSpec) InsertSQL() string

type PostGIS

type PostGIS struct {
	Db                *sql.DB
	Params            string
	Config            database.Config
	Tables            map[string]*TableSpec
	GeneralizedTables map[string]*GeneralizedTableSpec
	Prefix            string
	// contains filtered or unexported fields
}

func (*PostGIS) Abort

func (pg *PostGIS) Abort() error

func (*PostGIS) Begin

func (pg *PostGIS) Begin() error

func (*PostGIS) BeginBulk

func (pg *PostGIS) BeginBulk() error

func (*PostGIS) Close

func (pg *PostGIS) Close() error

func (*PostGIS) Delete

func (pg *PostGIS) Delete(id int64, matches []mapping.Match) error

func (*PostGIS) Deploy

func (pg *PostGIS) Deploy() error

func (*PostGIS) EnableGeneralizeUpdates

func (pg *PostGIS) EnableGeneralizeUpdates()

func (*PostGIS) End

func (pg *PostGIS) End() error

func (*PostGIS) Finish

func (pg *PostGIS) Finish() error

Finish creates spatial indices on all tables.

func (*PostGIS) Generalize

func (pg *PostGIS) Generalize() error

func (*PostGIS) GeneralizeUpdates

func (pg *PostGIS) GeneralizeUpdates() error

func (*PostGIS) Init

func (pg *PostGIS) Init() error

Init creates schema and tables, drops existing data.

func (*PostGIS) InsertLineString

func (pg *PostGIS) InsertLineString(elem osm.Element, geom geom.Geometry, matches []mapping.Match) error

func (*PostGIS) InsertPoint

func (pg *PostGIS) InsertPoint(elem osm.Element, geom geom.Geometry, matches []mapping.Match) error

func (*PostGIS) InsertPolygon

func (pg *PostGIS) InsertPolygon(elem osm.Element, geom geom.Geometry, matches []mapping.Match) error

func (*PostGIS) InsertRelationMember

func (pg *PostGIS) InsertRelationMember(rel osm.Relation, m osm.Member, geom geom.Geometry, matches []mapping.Match) error

func (*PostGIS) Open

func (pg *PostGIS) Open() error

func (*PostGIS) Optimize

func (pg *PostGIS) Optimize() error

Optimize clusters tables on new GeoHash index.

func (*PostGIS) RemoveBackup

func (pg *PostGIS) RemoveBackup() error

func (*PostGIS) RevertDeploy

func (pg *PostGIS) RevertDeploy() error

type SQLError

type SQLError struct {
	// contains filtered or unexported fields
}

func (*SQLError) Error

func (e *SQLError) Error() string

type SQLInsertError

type SQLInsertError struct {
	SQLError
	// contains filtered or unexported fields
}

func (*SQLInsertError) Error

func (e *SQLInsertError) Error() string

type TableSpec

type TableSpec struct {
	Name            string
	FullName        string
	Schema          string
	Columns         []ColumnSpec
	GeometryType    string
	Srid            int
	Generalizations []*GeneralizedTableSpec
}

func NewTableSpec

func NewTableSpec(pg *PostGIS, t *config.Table) (*TableSpec, error)

func (*TableSpec) CopySQL

func (spec *TableSpec) CopySQL() string

func (*TableSpec) CreateTableSQL

func (spec *TableSpec) CreateTableSQL() string

func (*TableSpec) DeleteSQL

func (spec *TableSpec) DeleteSQL() string

func (*TableSpec) InsertSQL

func (spec *TableSpec) InsertSQL() string

type TableTx

type TableTx interface {
	Begin(*sql.Tx) error
	Insert(row []interface{}) error
	Delete(id int64) error
	End()
	Commit() error
	Rollback()
}

func NewBulkTableTx

func NewBulkTableTx(pg *PostGIS, spec *TableSpec) TableTx

func NewSynchronousTableTx

func NewSynchronousTableTx(pg *PostGIS, tableName string, spec tableSpec) TableTx

type TxRouter

type TxRouter struct {
	Tables map[string]TableTx
	// contains filtered or unexported fields
}

TxRouter routes inserts/deletes to TableTx

func (*TxRouter) Abort

func (txr *TxRouter) Abort() error

func (*TxRouter) Delete

func (txr *TxRouter) Delete(table string, id int64) error

func (*TxRouter) End

func (txr *TxRouter) End() error

func (*TxRouter) Insert

func (txr *TxRouter) Insert(table string, row []interface{}) error

Jump to

Keyboard shortcuts

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