Documentation ¶
Overview ¶
fml is library for parsing MARC 21 formatted data.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ControlField ¶
ControlField just contains a Tag and a Value.
type DataField ¶
DataField contains two Indicators, a Tag, and a slice of SubFields. If you want a specific subfield or subfields you should use the SubField method.
type Leader ¶
type Leader struct { Status byte // 05 byte position Type byte // 06 BibLevel byte // 07 Control byte // 08 EncodingLevel byte // 17 Form byte // 18 Multipart byte // 19 }
Leader contains a subset of the bytes in the record leader. Omitted are bytes specifying the length of parts of the record and bytes which do not vary from record to record.
type MarcIterator ¶
type MarcIterator struct {
// contains filtered or unexported fields
}
MarcIterator will iterate over a set of MARC records using the Next() and Value() methods. Use the NewMarcIterator function to create a MarcIterator.
func NewMarcIterator ¶
func NewMarcIterator(r io.Reader) *MarcIterator
NewMarcIterator creates and returns a new instance of a MarcIterator. This function should be used to create a MarcIterator rather than instantiating one yourself.
func (*MarcIterator) Err ¶
func (m *MarcIterator) Err() error
Err will return the first error encountered by the MarcIterator.
func (*MarcIterator) Next ¶
func (m *MarcIterator) Next() bool
Next advances the MarcIterator to the next record, which will be available through the Value method. It returns false when the MarcIterator has reached the end of the file or has encountered an error. Any error will be accessible from the Err method.
func (*MarcIterator) Value ¶
func (m *MarcIterator) Value() (Record, error)
Value returns the current Record or the MarcIterator.
type Record ¶
Record is a struct representing a MARC record. It has a Fields slice which contains both ControlFields and DataFields.
func (Record) ControlField ¶
func (r Record) ControlField(tag ...string) []ControlField
ControlField method takes an arbitrary number of tag strings and returns a slice of matching ControlFields.
func (Record) ControlNum ¶
ControlNum returns the record's control number.
func (Record) DataField ¶
DataField method takes an arbitrary number of tag strings and returns a slice of matching DataFields. Note that one tag may return multiple DataFields as they can be repeated.
func (Record) Filter ¶
Filter takes one or more tag queries and returns a slice of strings matching the selected subfield values. A tag query consists of the three digit MARC tag optionally followed by one or more subfield codes, for example: "245ac", "650x" or "100". Filtering for indicators can be done by including the two desired indicators between pipes after the tag. An * character can be used for any inidicator, for example: "245|*1|ac" or 650|01|x.