lcnaf

package
v0.4.3 Latest Latest
Warning

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

Go to latest
Published: Jul 11, 2022 License: BSD-3-Clause Imports: 16 Imported by: 0

Documentation

Overview

Package lcnaf provides methods for working with Library of Congress Named Authority File (LCNAF) data.

Index

Constants

View Source
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.

View Source
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

func IsMultipleCandidates(e error) bool

IsMultipleCandidates returns a boolean value indicating whether 'e' is of type `MultipleCandidates`.

func IsNotFound

func IsNotFound(e error) bool

IsNotFound returns a boolean value indicating whether 'e' is of type `NotFound`.

func NewNamedAuthorityLookup

func NewNamedAuthorityLookup(ctx context.Context, uri string) (libraryofcongress.Lookup, error)

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`.

func OpenData added in v0.4.1

func OpenData(ctx context.Context, uri string) (io.ReadCloser, error)

OpenData() returns an `io.ReadCloser` instance containing LCNAF data derived from 'uri' which is expected to take the form of:

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
}

func (*NamedAuthorityLookup) Append

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

func (*NamedAuthorityLookup) Find

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

type NamedAuthorityLookupFunc

type NamedAuthorityLookupFunc func(context.Context)

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`.

type NotFound

type NotFound struct{ Code string }

type NotFound is a struct for representing missing LCNAF records.

func (NotFound) Error

func (e NotFound) Error() string

Error() returns a stringified representation of 'e'.

func (NotFound) String

func (e NotFound) String() string

String() returns a stringified representation of 'e'.

Jump to

Keyboard shortcuts

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