etl

package
v0.1.35 Latest Latest
Warning

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

Go to latest
Published: Dec 9, 2025 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateSearchIndex

func CreateSearchIndex(dbConn string, searchIndex string, srid int, lang language.Tag) error

CreateSearchIndex creates an empty search index in the target database

func GetVersion added in v0.1.34

func GetVersion(dbConn string, collectionID string, searchIndex string) (string, error)

GetVersion returns the current version of a collection in the target search index

func ImportFile

func ImportFile(collection config.GeoSpatialCollection, searchIndex string, collectionVersion string, filePath string,
	tables []config.FeatureTable, pageSize int, skipOptimize bool, dbConn string) error

ImportFile import source data into the target search index using extract-transform-load principle

Types

type Extract

type Extract interface {

	// Extract raw records from the source database to be transformed and loaded into the target search index
	Extract(table config.FeatureTable, fields []string, externaFidFields []string,
		where string, limit int, offset int) ([]t.RawRecord, error)

	// Close connection to the source database
	Close()
}

Extract - the 'E' in ETL. Datasource agnostic interface to extract source data.

type Load

type Load interface {

	// Init the target database by creating an empty search index
	Init(index string, srid int, lang language.Tag) error

	// Get the current version of a collection loaded in the search index
	GetVersion(collectionID string, index string) (string, error)

	// PreLoad hook to execute logic before loading records into the search index.
	// For example, by creating tables or partitions
	PreLoad(collectionID string, index string) error

	// Load records into the search index. Returns the number of records loaded.
	// Assumes the index is already initialized.
	Load(records []t.SearchIndexRecord) (int64, error)

	// PostLoad hook to execute logic after loading records into the search index.
	// For example, by switching partitions or rebuilding indexes.
	PostLoad(collectionID string, index string, collectionVersion string) error

	// Optimize once ETL is completed (optional)
	Optimize() error

	// Close connection to the target database
	Close()
}

Load - the 'L' in ETL. Datasource agnostic interface to load data into target database.

type Transform

type Transform interface {

	// Transform each raw record in one or more search records depending on the given configuration
	Transform(records []t.RawRecord, collection config.GeoSpatialCollection) ([]t.SearchIndexRecord, error)
}

Transform - the 'T' in ETL. Logic to transform raw records to search index records

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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