publicart

package
v0.3.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsMultipleCandidates added in v0.0.2

func IsMultipleCandidates(e error) bool

func IsNotFound added in v0.0.2

func IsNotFound(e error) bool

func NewLookup

func NewLookup(ctx context.Context, uri string) (curatorial.Lookup, error)

NewLookup will return an `curatorial.Lookup` instance. By default the lookup table is derived from precompiled (embedded) data in `data/publicart.json` by passing in `publicart://` as the URI. It is also possible to create a new lookup table with the following URI options:

`publicart://github`

This will cause the lookup table to be derived from the data stored at https://raw.githubusercontent.com/sfomuseum/go-sfomuseum-curatorial/main/data/publicart.json. This might be desirable if there have been updates to the underlying data that are not reflected in the locally installed package's pre-compiled data.

`publicart://iterator?uri={URI}&source={SOURCE}`

This will cause the lookup table to be derived, at runtime, from data emitted by a `whosonfirst/go-whosonfirst-iterate` instance. `{URI}` should be a valid `whosonfirst/go-whosonfirst-iterate/iterator` URI and `{SOURCE}` is one or more URIs for the iterator to process.

func NewLookupFromIterator

func NewLookupFromIterator(ctx context.Context, iterator_uri string, iterator_sources ...string) (curatorial.Lookup, error)

func NewLookupWithLookupFunc

func NewLookupWithLookupFunc(ctx context.Context, lookup_func PublicArtLookupFunc) (curatorial.Lookup, error)

NewLookupWithLookupFunc will return an `curatorial.Lookup` instance derived by data compiled using `lookup_func`.

Types

type MultipleCandidates added in v0.0.2

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

func (MultipleCandidates) Error added in v0.0.2

func (e MultipleCandidates) Error() string

func (MultipleCandidates) String added in v0.0.2

func (e MultipleCandidates) String() string

type NotFound added in v0.0.2

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

func (NotFound) Error added in v0.0.2

func (e NotFound) Error() string

func (NotFound) String added in v0.0.2

func (e NotFound) String() string

type PublicArtLookup

type PublicArtLookup struct {
	curatorial.Lookup
}

func (*PublicArtLookup) Append

func (l *PublicArtLookup) Append(ctx context.Context, data interface{}) error

func (*PublicArtLookup) Find

func (l *PublicArtLookup) Find(ctx context.Context, code string) ([]interface{}, error)

type PublicArtLookupFunc

type PublicArtLookupFunc func(context.Context)

func NewLookupFuncWithPublicArtWorks

func NewLookupFuncWithPublicArtWorks(ctx context.Context, publicart_list []*PublicArtWork) PublicArtLookupFunc

NewLookup will return an `PublicArtLookupFunc` function instance that, when invoked, will populate an `curatorial.Lookup` instance with data stored in `publicart_list`.

func NewLookupFuncWithReader

func NewLookupFuncWithReader(ctx context.Context, r io.ReadCloser) PublicArtLookupFunc

NewLookup will return an `PublicArtLookupFunc` function instance that, when invoked, will populate an `curatorial.Lookup` instance with data stored in `r`. `r` will be closed when the `PublicArtLookupFunc` function instance is invoked. It is assumed that the data in `r` will be formatted in the same way as the procompiled (embedded) data stored in `data/sfomuseum.json`.

type PublicArtWork

type PublicArtWork struct {
	WhosOnFirstId int64  `json:"wof:id"`
	Name          string `json:"wof:name"`
	SFOMuseumId   int64  `json:"sfomuseum:object_id"`
	MapId         string `json:"sfomuseum:map_id"`
	IsCurrent     int64  `json:"mz:is_current"`
}

func CompilePublicArtWorksData

func CompilePublicArtWorksData(ctx context.Context, iterator_uri string, iterator_sources ...string) ([]*PublicArtWork, error)

func FindCurrentPublicArtWork added in v0.0.2

func FindCurrentPublicArtWork(ctx context.Context, code string) (*PublicArtWork, error)

Return the current PublicArtWork matching 'code'. Multiple matches throw an error.

func FindCurrentPublicArtWorkWithLookup added in v0.0.2

func FindCurrentPublicArtWorkWithLookup(ctx context.Context, lookup curatorial.Lookup, code string) (*PublicArtWork, error)

Return the current PublicArtWork matching 'code' with a custom curatorial.Lookup instance. Multiple matches throw an error.

func FindPublicArtWorksCurrent added in v0.0.2

func FindPublicArtWorksCurrent(ctx context.Context, code string) ([]*PublicArtWork, error)

Returns all PublicArtWork instances matching 'code' that are marked as current.

func FindPublicArtWorksCurrentWithLookup added in v0.0.2

func FindPublicArtWorksCurrentWithLookup(ctx context.Context, lookup curatorial.Lookup, code string) ([]*PublicArtWork, error)

Returns all PublicArtWork instances matching 'code' that are marked as current with a custom curatorial.Lookup instance.

func (*PublicArtWork) String

func (w *PublicArtWork) String() string

Jump to

Keyboard shortcuts

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