Documentation ¶
Overview ¶
package terminals provides methods for working with boarding terminals at SFO.
Index ¶
- Constants
- func IsMultipleCandidates(e error) bool
- func IsNotFound(e error) bool
- func NewLookup(ctx context.Context, uri string) (architecture.Lookup, error)
- func NewLookupFromIterator(ctx context.Context, iterator_uri string, iterator_sources ...string) (architecture.Lookup, error)
- func NewLookupWithLookupFunc(ctx context.Context, lookup_func TerminalsLookupFunc) (architecture.Lookup, error)
- type MultipleCandidates
- type NotFound
- type Terminal
- func CompileTerminalsData(ctx context.Context, iterator_uri string, iterator_sources ...string) ([]*Terminal, error)
- func FindCurrentTerminal(ctx context.Context, code string) (*Terminal, error)
- func FindCurrentTerminalWithLookup(ctx context.Context, lookup architecture.Lookup, code string) (*Terminal, error)
- func FindTerminalsCurrent(ctx context.Context, code string) ([]*Terminal, error)
- func FindTerminalsCurrentWithLookup(ctx context.Context, lookup architecture.Lookup, code string) ([]*Terminal, error)
- type TerminalsLookup
- type TerminalsLookupFunc
Constants ¶
const DATA_JSON string = "terminals.json"
Variables ¶
This section is empty.
Functions ¶
func IsMultipleCandidates ¶
func IsNotFound ¶
func NewLookup ¶
NewLookup will return an `architecture.Lookup` instance. By default the lookup table is derived from precompiled (embedded) data in `data/terminals.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/terminals.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 NewLookupWithLookupFunc ¶
func NewLookupWithLookupFunc(ctx context.Context, lookup_func TerminalsLookupFunc) (architecture.Lookup, error)
NewLookupWithLookupFunc will return an `architecture.Lookup` instance derived by data compiled using `lookup_func`.
Types ¶
type MultipleCandidates ¶
type MultipleCandidates struct {
// contains filtered or unexported fields
}
func (MultipleCandidates) Error ¶
func (e MultipleCandidates) Error() string
func (MultipleCandidates) String ¶
func (e MultipleCandidates) String() string
type Terminal ¶
type Terminal struct { // The Who's On First ID associated with this terminal. WhosOnFirstId int64 `json:"wof:id"` // The SFO Museum name/label for this terminal SFOMuseumId string `json:"sfomuseum:terminal_id,omityempty"` // The name of this terminal. Name string `json:"wof:name"` // A Who's On First "existential" (`KnownUnknownFlag`) flag signaling the terminal's status IsCurrent int64 `json:"mz:is_current"` // The list of name:{LANG}_x_preferred names for this terminal PreferredNames []string `json:"name:preferred,omitempty"` // The list of name:{LANG}_x_variant names for this terminal VariantNames []string `json:"name:variant,omitempty"` }
type Terminal is a struct representing a passenger terminal at SFO.
func CompileTerminalsData ¶
func CompileTerminalsData(ctx context.Context, iterator_uri string, iterator_sources ...string) ([]*Terminal, error)
CompileTerminalsData will generate a list of `Terminal` struct to be used as the source data for an `SFOMuseumLookup` instance. The list of terminal 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 FindCurrentTerminal ¶
Return the current Terminal matching 'code'. Multiple matches throw an error.
func FindCurrentTerminalWithLookup ¶
func FindCurrentTerminalWithLookup(ctx context.Context, lookup architecture.Lookup, code string) (*Terminal, error)
Return the current Terminal matching 'code' with a custom architecture.Lookup instance. Multiple matches throw an error.
func FindTerminalsCurrent ¶
Returns all Terminal instances matching 'code' that are marked as current.
type TerminalsLookup ¶
type TerminalsLookup struct {
architecture.Lookup
}
type TerminalsLookupFunc ¶
func NewLookupFuncWithReader ¶
func NewLookupFuncWithReader(ctx context.Context, r io.ReadCloser) TerminalsLookupFunc
NewLookupWithReader will return an `TerminalsLookupFunc` function instance that, when invoked, will populate an `architecture.Lookup` instance with data stored in `r`. `r` will be closed when the `TerminalsLookupFunc` 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`.
func NewLookupFuncWithTerminals ¶
func NewLookupFuncWithTerminals(ctx context.Context, terminals_list []*Terminal) TerminalsLookupFunc
NewLookupFuncWithTerminals will return an `TerminalsLookupFunc` function instance that, when invoked, will populate an `architecture.Lookup` instance with data stored in `terminals_list`.