Documentation ¶
Overview ¶
Package lcnaf provides methods for working with Library of Congress Named Authority File (LCNAF) data.
Index ¶
- Constants
- func IsMultipleCandidates(e error) bool
- func IsNotFound(e error) bool
- func NewNamedAuthorityLookup(ctx context.Context, uri string) (libraryofcongress.Lookup, error)
- func NewNamedAuthorityLookupWithLookupFunc(ctx context.Context, lookup_func NamedAuthorityLookupFunc) (libraryofcongress.Lookup, error)
- func OpenData(ctx context.Context, uri string) (io.ReadCloser, error)
- type MultipleCandidates
- type NamedAuthority
- type NamedAuthorityLookup
- type NamedAuthorityLookupFunc
- type NotFound
Constants ¶
const DATA_GITHUB string = "https://github.com/sfomuseum/go-sfomuseum-libraryofcongress/raw/main/data/lcnaf.csv.bz2"
DATA_GITHUB is the URL for the embedded LCNAF data included with this package on GitHub.
const DATA_JSON string = "lcnaf.csv.bz2"
DATA_JSON is the name of the embedded LCNAF data included with this package.
Variables ¶
This section is empty.
Functions ¶
func IsMultipleCandidates ¶
IsMultipleCandidates returns a boolean value indicating whether 'e' is of type `MultipleCandidates`.
func IsNotFound ¶
IsNotFound returns a boolean value indicating whether 'e' is of type `NotFound`.
func NewNamedAuthorityLookup ¶
func NewNamedAuthorityLookupWithLookupFunc ¶
func NewNamedAuthorityLookupWithLookupFunc(ctx context.Context, lookup_func NamedAuthorityLookupFunc) (libraryofcongress.Lookup, error)
NewNamedAuthorityLookupWithLookupFunc will return an `airports.NamedAuthoritysLookup` instance derived by data compiled using `lookup_func`.
Types ¶
type MultipleCandidates ¶
type MultipleCandidates struct{ Code string }
type NotFound is a struct for representing LCNAF identifiers that return multiple records.
func (MultipleCandidates) Error ¶
func (e MultipleCandidates) Error() string
Error() returns a stringified representation of 'e'.
func (MultipleCandidates) String ¶
func (e MultipleCandidates) String() string
String() returns a stringified representation of 'e'.
type NamedAuthority ¶
type NamedAuthority struct { // Id is the unique identifier for this LCNAF record. Id string `json:"id"` // Label is the name (or title) for this LCNAF record. Label string `json:"label"` }
NamedAuthority is a struct containing a subset of data for a LCNAF record.
func (*NamedAuthority) String ¶
func (na *NamedAuthority) String() string
String() returns the a string-ified representation of the record's Id and Label properties.
type NamedAuthorityLookup ¶
type NamedAuthorityLookup struct {
libraryofcongress.Lookup
}
type NamedAuthorityLookupFunc ¶
func NewNamedAuthorityLookupFuncWithReader ¶
func NewNamedAuthorityLookupFuncWithReader(ctx context.Context, r io.ReadCloser) NamedAuthorityLookupFunc
NewNamedAuthorityLookup will return an `NamedAuthorityLookupFunc` function instance that, when invoked, will populate an `airports.NamedAuthoritysLookup` instance with data stored in `r`. `r` will be closed when the `NamedAuthorityLookupFunc` 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`.