galleries

package
v0.8.3 Latest Latest
Warning

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

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

Documentation

Overview

package galleries provides methods for working with boarding galleries at SFO.

Index

Constants

View Source
const DATA_JSON string = "galleries.json"

Variables

This section is empty.

Functions

func GeometryForGalleryIDs

func GeometryForGalleryIDs(ctx context.Context, r reader.Reader, gallery_ids ...int64) (orb.Geometry, error)

Derive a MultiPoint geoemtry for one or more gallery IDs.

func IsMultipleCandidates added in v0.0.11

func IsMultipleCandidates(e error) bool

func IsNotFound added in v0.0.11

func IsNotFound(e error) bool

func NewLookup

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

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

`sfomuseum://github`

This will cause the lookup table to be derived from the data stored at https://raw.githubusercontent.com/sfomuseum/go-sfomuseum-architecture/main/data/galleries.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.

`sfomuseum://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) (architecture.Lookup, error)

func NewLookupWithLookupFunc

func NewLookupWithLookupFunc(ctx context.Context, lookup_func GalleriesLookupFunc) (architecture.Lookup, error)

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

Types

type GalleriesLookup

type GalleriesLookup struct {
	architecture.Lookup
}

func (*GalleriesLookup) Append

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

func (*GalleriesLookup) Find

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

type GalleriesLookupFunc

type GalleriesLookupFunc func(context.Context)

func NewLookupFuncWithGalleries

func NewLookupFuncWithGalleries(ctx context.Context, galleries_list []*Gallery) GalleriesLookupFunc

NewLookup will return an `GalleriesLookupFunc` function instance that, when invoked, will populate an `architecture.Lookup` instance with data stored in `galleries_list`.

func NewLookupFuncWithReader

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

NewLookup will return an `GalleriesLookupFunc` function instance that, when invoked, will populate an `architecture.Lookup` instance with data stored in `r`. `r` will be closed when the `GalleriesLookupFunc` 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 Gallery struct {
	// The Who's On First ID associated with this gallery.
	WhosOnFirstId int64 `json:"wof:id"`
	// The SFO Museum ID associated with this gallery.
	SFOMuseumId int64 `json:"sfomuseum:id"`
	// The map label (ID) associated with this gallery.
	MapId string `json:"map_id"`
	// The name of this gallery.
	Name string `json:"wof:name"`
	// The (EDTF) inception date for the gallery
	Inception string `json:"edtf:inception"`
	// The (EDTF) cessation date for the gallery
	Cessation string `json:"edtf:cessation"`
	// A Who's On First "existential" (`KnownUnknownFlag`) flag signaling the gallery's status
	IsCurrent int64 `json:"mz:is_current"`
}

type Gallery is a struct representing a passenger gallery at SFO.

func CompileGalleriesData

func CompileGalleriesData(ctx context.Context, iterator_uri string, iterator_sources ...string) ([]*Gallery, error)

CompileGalleriesData will generate a list of `Gallery` struct to be used as the source data for an `SFOMuseumLookup` instance. The list of gate are compiled by iterating over one or more source. `iterator_uri` is a valid `whosonfirst/go-whosonfirst-iterate` URI and `iterator_sources` are one more (iterator) URIs to process.

func FindAllGalleriesForDate added in v0.8.0

func FindAllGalleriesForDate(ctx context.Context, code string, date string) ([]*Gallery, error)

Return all the Galleries matching 'code' that were active for 'date'.

func FindAllGalleriesForDateWithLookup added in v0.8.0

func FindAllGalleriesForDateWithLookup(ctx context.Context, lookup architecture.Lookup, code string, date string) ([]*Gallery, error)

Return all the Gallerys matching 'code' that were active for 'date' using 'lookup'.

func FindCurrentGallery added in v0.0.11

func FindCurrentGallery(ctx context.Context, code string) (*Gallery, error)

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

func FindCurrentGalleryWithLookup added in v0.0.11

func FindCurrentGalleryWithLookup(ctx context.Context, lookup architecture.Lookup, code string) (*Gallery, error)

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

func FindGalleriesCurrent added in v0.0.11

func FindGalleriesCurrent(ctx context.Context, code string) ([]*Gallery, error)

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

func FindGalleriesCurrentWithLookup added in v0.0.11

func FindGalleriesCurrentWithLookup(ctx context.Context, lookup architecture.Lookup, code string) ([]*Gallery, error)

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

func FindGalleryForDate added in v0.8.0

func FindGalleryForDate(ctx context.Context, code string, date string) (*Gallery, error)

Return the Gallery matching 'code' that was active for 'date'. Multiple matches throw an error.

func FindGalleryForDateWithLookup added in v0.8.0

func FindGalleryForDateWithLookup(ctx context.Context, lookup architecture.Lookup, code string, date string) (*Gallery, error)

Return the Gallery matching 'code' that was active for 'date' using 'lookup'. Multiple matches throw an error.

func (*Gallery) String

func (g *Gallery) String() string

String() will return the name of the gallery.

type MultipleCandidates added in v0.0.11

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

func (MultipleCandidates) Error added in v0.0.11

func (e MultipleCandidates) Error() string

func (MultipleCandidates) String added in v0.0.11

func (e MultipleCandidates) String() string

type NotFound added in v0.0.11

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

func (NotFound) Error added in v0.0.11

func (e NotFound) Error() string

func (NotFound) String added in v0.0.11

func (e NotFound) String() string

Jump to

Keyboard shortcuts

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