fields

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2021 License: BSD-3-Clause Imports: 8 Imported by: 0

Documentation

Overview

package fields provides methods for working with individual fields in MARC records.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Coord

type Coord struct {
	// DD is the coordinate in decimal degrees.
	DD float64
	// Hemisphere is a geographic hemisphere of the coordinate.
	Hemisphere string
}

type Coord wraps a geographic coordinate defined in a MARC 034 field.

func Parse034Coordinate

func Parse034Coordinate(raw string, hemisphere string) (*Coord, error)

Parse034Coordinate parses an individual coordinate string from a MARC 034 field.

func (*Coord) String added in v1.0.0

func (c *Coord) String() string

type Parsed

type Parsed struct {
	// The scale used in the parsed MARC 034 field.
	Scale *Scale
	// The ring used in the parsed MARC 034 field.
	Ring *Ring
	// The subfields listed in the parsed MARC 034 field.
	Subfields map[string]*Subfield
}

type Parsed encapsulates the result of a MARC 034 field that has been parsed.

func Parse034

func Parse034(raw string) (*Parsed, error)

Parse034 parses a MARC 034 field as defined by https://www.loc.gov/marc/bibliographic/bd034.html in to a `Parsed` instance.

func (*Parsed) Bound added in v0.9.1

func (p *Parsed) Bound() (*orb.Bound, error)

Bound returns an `orb.Bound` instance (a bounding box) for a parsed MARC 034 field.

func (*Parsed) String

func (p *Parsed) String() string

String returns p as a MARC-encoded 034 field.

type Ring

type Ring struct {
	Code string
}

type Ring encapsulates the type of ring used in a MARC 034 field.

func NewRing

func NewRing(code string) (*Ring, error)

NewRing return a new `Ring` instance for code.

func (*Ring) String

func (r *Ring) String() string

String returns the code value for r.

type Scale

type Scale struct {
	// Code is the
	Code string
}

type Scale encapsulates the type of scale used in a MARC 034 field.

func NewScale

func NewScale(code string) (*Scale, error)

NewScale return a new `Scale` instance for code.

func (*Scale) String

func (s *Scale) String() string

String returns the code value for s.

type Subfield

type Subfield struct {
	Code  string
	Value string
}

type Subfield encapsulates the different types of subfield used in a MARC 034 field.

func NewSubfield

func NewSubfield(code string, value string) (*Subfield, error)

NewSubfield returns a new `Subfield` instance for code and value.

func (*Subfield) String

func (sf *Subfield) String() string

String returns the subfield (code and value) value for sf.

Jump to

Keyboard shortcuts

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