traveler

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2024 License: BSD-3-Clause Imports: 6 Imported by: 1

Documentation

Overview

Package traveller defines task-specific traveler methods.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BelongsToTravelFunc

type BelongsToTravelFunc func(context.Context, []byte, int64) error

type BelongsToTravelFunc defines custom callback function to be invoked for records matching a "wof:belongs_to" condition.

func NewDefaultBelongsToTravelFunc

func NewDefaultBelongsToTravelFunc() (BelongsToTravelFunc, error)

NewDefaultBelongsToTravelFunc() returns a `BelongsToTravelFunc` instance that prints metadata about records matching a "wof:belongs_to" condition to STDOUT.

type BelongsToTraveler

type BelongsToTraveler struct {
	// Callback is a `BelongsToTravelFunc` function to be invoked for records matching a "wof:belongs_to" condition.
	Callback BelongsToTravelFunc
	// IteratorURI is a valid `whosonfirst/go-whosonfirst-iterate/v2` URI used to crawl (iterate) records.
	IteratorURI string
	// BelongsTo list of WOF IDs that matching records should belong to.
	BelongsTo []int64
}

type BelongsToTraveler defines a struct

func NewDefaultBelongsToTraveler

func NewDefaultBelongsToTraveler() (*BelongsToTraveler, error)

NewDefaultBelongsToTraveler() returns a a `BelongsToTraveler` with default values. Specifically one that expects to iterate documents in `repo://` mode, using a default callback function (defined by `NewDefaultBelongsToTravelFunc` and an empty list of the IDs that matching records should belong to.

func (*BelongsToTraveler) Travel

func (t *BelongsToTraveler) Travel(ctx context.Context, uris ...string) error

Travel() iterates through all the records emitted by 'uris' and invokes `t.Callback` for records whose "wof:belongs_to" values match one or more of the IDs defined in `t.BelongTo`.

Jump to

Keyboard shortcuts

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