indexer

package
v0.0.8 Latest Latest
Warning

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

Go to latest
Published: Dec 15, 2024 License: BSD-3-Clause Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type IndexRelationsFuncOptions

type IndexRelationsFuncOptions struct {
	// Reader is a valid `whosonfirst/go-reader` instance used to load Who's On First feature data
	Reader reader.Reader
	// Strict is a boolean flag indicating whether the failure to load or parse feature record should trigger a critical error.
	Strict bool
}

IndexRelationsFuncOptions

type Indexer

type Indexer struct {

	// Timings is a boolean flag indicating whether timings (time to index records) should be recorded)
	Timings bool
	// contains filtered or unexported fields
}

Indexer is a struct that provides methods for indexing records in one or more SQLite database_sql.tables

func NewIndexer

func NewIndexer(opts *IndexerOptions) (*Indexer, error)

NewSQLiteInder returns a `Indexer` configured with 'opts'.

func (*Indexer) IndexURIs

func (idx *Indexer) IndexURIs(ctx context.Context, iterator_uri string, uris ...string) error

IndexURIs will index records returned by the `whosonfirst/go-whosonfirst-iterate` instance for 'uris',

type IndexerLoadRecordFunc

type IndexerLoadRecordFunc func(context.Context, string, io.ReadSeeker, ...interface{}) (interface{}, error)

IndexerLoadRecordFunc is a custom `whosonfirst/go-whosonfirst-iterate/v2` callback function to be invoked for each record processed by the `IndexURIs` method.

func LoadRecordFunc

func LoadRecordFunc(opts *LoadRecordFuncOptions) IndexerLoadRecordFunc

LoadRecordFunc returns a `go-whosonfirst-sql/indexer/IndexerLoadRecordFunc` callback function that will ensure the the record being processed is a valid Who's On First GeoJSON Feature record.

type IndexerOptions

type IndexerOptions struct {
	// DB is the `database_sql.sql.DB` instance that records will be indexed in.
	DB *sql.DB
	// Tables is the list of `sfomuseum/go-database_sql.Table` instances that records will be indexed in.
	Tables []database_sql.Table
	// LoadRecordFunc is a custom `whosonfirst/go-whosonfirst-iterate/v2` callback function to be invoked
	// for each record processed by	the `IndexURIs`	method.
	LoadRecordFunc IndexerLoadRecordFunc
	// PostIndexFunc is an optional custom function to invoke after a record has been indexed.
	PostIndexFunc IndexerPostIndexFunc
}

IndexerOptions

type IndexerPostIndexFunc

type IndexerPostIndexFunc func(context.Context, *sql.DB, []database_sql.Table, interface{}) error

IndexerPostIndexFunc is a custom function to invoke after a record has been indexed.

func IndexRelationsFunc

func IndexRelationsFunc(r reader.Reader) IndexerPostIndexFunc

IndexRelationsFunc returns a `go-whosonfirst-sql/indexer/IndexerPostIndexFunc` callback function used to index relations for a WOF record after that record has been successfully indexed.

func IndexRelationsFuncWithOptions

func IndexRelationsFuncWithOptions(opts *IndexRelationsFuncOptions) IndexerPostIndexFunc

IndexRelationsFuncWithOptions returns a `go-whosonfirst-sql/indexer/IndexerPostIndexFunc` callback function used to index relations for a WOF record after that record has been successfully indexed, but with custom `IndexRelationsFuncOptions` options defined in 'opts'.

type LoadRecordFuncOptions

type LoadRecordFuncOptions struct {
	// StrictAltFiles is a boolean flag indicating whether the failure to load or parse an alternate geometry file should trigger a critical error.
	StrictAltFiles bool
}

LoadRecordFuncOptions is a struct to define options when loading Who's On First feature records.

Jump to

Keyboard shortcuts

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