Documentation ¶
Index ¶
- func IsMultipleCandidates(e error) bool
- func IsNotFound(e error) bool
- func NewLookup(ctx context.Context, uri string) (curatorial.Lookup, error)
- func NewLookupFromIterator(ctx context.Context, iterator_uri string, iterator_sources ...string) (curatorial.Lookup, error)
- func NewLookupWithLookupFunc(ctx context.Context, lookup_func ExhibitionsLookupFunc) (curatorial.Lookup, error)
- type Exhibition
- func CompileExhibitionsData(ctx context.Context, iterator_uri string, iterator_sources ...string) ([]*Exhibition, error)
- func FindCurrentExhibition(ctx context.Context, code string) (*Exhibition, error)
- func FindCurrentExhibitionWithLookup(ctx context.Context, lookup curatorial.Lookup, code string) (*Exhibition, error)
- func FindExhibitionsCurrent(ctx context.Context, code string) ([]*Exhibition, error)
- func FindExhibitionsCurrentWithLookup(ctx context.Context, lookup curatorial.Lookup, code string) ([]*Exhibition, error)
- type ExhibitionsLookup
- type ExhibitionsLookupFunc
- type MultipleCandidates
- type NotFound
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsMultipleCandidates ¶ added in v0.0.2
func IsNotFound ¶ added in v0.0.2
func NewLookup ¶
NewLookup will return an `curatorial.Lookup` instance. By default the lookup table is derived from precompiled (embedded) data in `data/exhibitions.json` by passing in `exhibitions://` as the URI. It is also possible to create a new lookup table with the following URI options:
`exhibitions://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/exhibitions.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.
`exhibitions://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 NewLookupWithLookupFunc ¶
func NewLookupWithLookupFunc(ctx context.Context, lookup_func ExhibitionsLookupFunc) (curatorial.Lookup, error)
NewLookupWithLookupFunc will return an `curatorial.Lookup` instance derived by data compiled using `lookup_func`.
Types ¶
type Exhibition ¶
type Exhibition struct { WhosOnFirstId int64 `json:"wof:id"` Name string `json:"wof:name"` SFOMuseumId int64 `json:"sfomuseum:exhibition_id"` SFOMuseumWWWId int64 `json:"sfomuseum_www:exhibition_id"` IsCurrent int64 `json:"mz:is_current"` }
func CompileExhibitionsData ¶
func FindCurrentExhibition ¶ added in v0.0.2
func FindCurrentExhibition(ctx context.Context, code string) (*Exhibition, error)
Return the current Exhibition matching 'code'. Multiple matches throw an error.
func FindCurrentExhibitionWithLookup ¶ added in v0.0.2
func FindCurrentExhibitionWithLookup(ctx context.Context, lookup curatorial.Lookup, code string) (*Exhibition, error)
Return the current Exhibition matching 'code' with a custom curatorial.Lookup instance. Multiple matches throw an error.
func FindExhibitionsCurrent ¶ added in v0.0.2
func FindExhibitionsCurrent(ctx context.Context, code string) ([]*Exhibition, error)
Returns all Exhibition instances matching 'code' that are marked as current.
func FindExhibitionsCurrentWithLookup ¶ added in v0.0.2
func FindExhibitionsCurrentWithLookup(ctx context.Context, lookup curatorial.Lookup, code string) ([]*Exhibition, error)
Returns all Exhibition instances matching 'code' that are marked as current with a custom curatorial.Lookup instance.
func (*Exhibition) String ¶
func (w *Exhibition) String() string
type ExhibitionsLookup ¶
type ExhibitionsLookup struct {
curatorial.Lookup
}
type ExhibitionsLookupFunc ¶
func NewLookupFuncWithExhibitions ¶
func NewLookupFuncWithExhibitions(ctx context.Context, exhibitions_list []*Exhibition) ExhibitionsLookupFunc
NewLookup will return an `ExhibitionsLookupFunc` function instance that, when invoked, will populate an `curatorial.Lookup` instance with data stored in `exhibitions_list`.
func NewLookupFuncWithReader ¶
func NewLookupFuncWithReader(ctx context.Context, r io.ReadCloser) ExhibitionsLookupFunc
NewLookup will return an `ExhibitionsLookupFunc` function instance that, when invoked, will populate an `curatorial.Lookup` instance with data stored in `r`. `r` will be closed when the `ExhibitionsLookupFunc` 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 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