resolver

package
v2.8.7 Latest Latest
Warning

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

Go to latest
Published: Aug 27, 2024 License: BSD-3-Clause Imports: 18 Imported by: 3

Documentation

Overview

package resolver providers common methods and interfaces for retrieving repository data from a variety of storage systems.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RegisterResolver

func RegisterResolver(ctx context.Context, scheme string, f ResolverInitializeFunc) error

func Schemes

func Schemes() []string

Types

type DocstoreResolver

type DocstoreResolver struct {
	Resolver
	// contains filtered or unexported fields
}

type DocstoreResolver implements the `Resolver` interface for data stored in a gocloud.dev/docstore compatible collection.

func (*DocstoreResolver) GetRepo

func (r *DocstoreResolver) GetRepo(ctx context.Context, id int64) (string, error)

GetRepo returns the name of the repository associated with this ID in a Who's On First finding aid.

type HTTPResolver

type HTTPResolver struct {
	Resolver
	// contains filtered or unexported fields
}

type HTTPResolver implements the `Resolver` interface for data stored in a database exposed via an HTTP endpoint.

func (*HTTPResolver) GetRepo

func (r *HTTPResolver) GetRepo(ctx context.Context, id int64) (string, error)

GetRepo returns the name of the repository associated with this ID in a Who's On First finding aid.

type ReaderResolver added in v2.5.0

type ReaderResolver struct {
	Resolver
	// contains filtered or unexported fields
}

type ReaderResolver implements the `Resolver` interface for data that can be resolved using a whosonfirst/go-reader.Reader instance.

func (*ReaderResolver) GetRepo added in v2.5.0

func (r *ReaderResolver) GetRepo(ctx context.Context, id int64) (string, error)

GetRepo returns the name of the repository associated with this ID.

type Resolver

type Resolver interface {
	// GetRepo returns the repository name matching an ID.
	GetRepo(context.Context, int64) (string, error)
}

type Resolver defines a storage-independent interface for retrieving a repository name given an ID.

func NewDocstoreResolver

func NewDocstoreResolver(ctx context.Context, uri string) (Resolver, error)

NewDocstoreResolver will return a new `Resolver` instance for resolving repository names and IDs stored in a gocloud.dev/docstore Collection.

func NewHTTPResolver

func NewHTTPResolver(ctx context.Context, uri string) (Resolver, error)

NewHTTPResolver will return a new `Resolver` instance for resolving repository names and IDs stored in a database exposed via an HTTP endpoint..

func NewReaderResolver added in v2.5.0

func NewReaderResolver(ctx context.Context, uri string) (Resolver, error)

NewReaderResolver will return a new `Resolver` instance for resolving repository names that can be resolved using a whosonfirst/go-reader.Reader instance derived from 'uri'. 'uri' takes the form of:

reader://?reader={READER_URI}&strategy={STRATEGY}

Where:

  • {READER_URI} is a valid whosonfirst/go-reader.Reader URI
  • {STRATEGY} is a string describing the strategy use to expand the 'id' parameter passed to the `GetRepo` method to a URI. Valid options are: ** 'fname' which will expand '101736545' to '101736545.geojson' (default) ** 'uri' which will expand '101736545' to '101/736/545/101736545.geojson'

func NewResolver

func NewResolver(ctx context.Context, uri string) (Resolver, error)

func NewSQLiteResolver

func NewSQLiteResolver(ctx context.Context, uri string) (Resolver, error)

NewSQLiteResolver will return a new `Resolver` instance for resolving repository names and IDs stored in a SQLite database.

type ResolverInitializeFunc

type ResolverInitializeFunc func(ctx context.Context, uri string) (Resolver, error)

type ResolverInitializeFunc defines an initialization function for a storage-specific implementation of the Resolver interface.

type SQLiteResolver

type SQLiteResolver struct {
	Resolver
	// contains filtered or unexported fields
}

type SQLiteResolver implements the `Resolver` interface for data stored in a SQLite database..

func (*SQLiteResolver) GetRepo

func (r *SQLiteResolver) GetRepo(ctx context.Context, id int64) (string, error)

GetRepo returns the name of the repository associated with this ID in a Who's On First finding aid.

Jump to

Keyboard shortcuts

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