holdings

package
v0.1.140 Latest Latest
Warning

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

Go to latest
Published: Mar 6, 2017 License: GPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrBeforeCoverageInterval = errors.New("before coverage interval")
	ErrAfterCoverageInterval  = errors.New("after coverage interval")
	ErrMissingValues          = errors.New("missing values")
	ErrMovingWall             = errors.New("moving wall")
	ErrUnparsedTime           = errors.New("unparsed time")
)

Functions

This section is empty.

Types

type Entries added in v0.1.75

type Entries map[string][]License

Entries holds a list of license entries keyed by ISSN. The ISSN should be written as 1234-567X, according to the standard (https://en.wikipedia.org/wik i/International_Standard_Serial_Number#Code_format). The format of the ISSN is an eight digit code, divided by a hyphen into two four-digit numbers. Not an interface since it should not be more complicated than this.

func (Entries) Licenses added in v0.1.75

func (e Entries) Licenses(issn string) []License

Licenses make Entries fulfill the holdings interface.

type Entry added in v0.1.75

type Entry struct {
	Begin                  Signature
	End                    Signature
	Embargo                time.Duration
	EmbargoDisallowEarlier bool
}

Entry is a reduced holding file entry. Usually, moving wall allow the items, that lie earlier than the boundary. If EmbargoDisallowEarlier is set, the effect is reversed.

func (Entry) Covers added in v0.1.75

func (e Entry) Covers(s Signature) error

Covers returns true if the given signature lies inside the interval defined by the entry and the moving wall is not hit. If there the dates are not comparable the volume and issue comparisons do not make much sense. However, if there is a date, we are ok with a missing volume or a missing issue.

func (Entry) String added in v0.1.120

func (e Entry) String() string

func (Entry) TimeRestricted added in v0.1.75

func (e Entry) TimeRestricted(t time.Time) error

TimeRestricted returns an error, if the given time falls within the moving wall set by the Entry. The embargo is simply added to the current time, so it should expressed with negative values.

type File added in v0.1.75

type File interface {
	ReadEntries() (Entries, error)
}

File is the interface implemented by all holdings file formats. It can return a list of entries.

type Holdings added in v0.1.75

type Holdings interface {
	Licenses(string) []License
}

Holdings can return a list of licenses for a given ISSN.

type License

type License interface {
	// Covers looks at the static content only.
	Covers(Signature) error
}

License exposes methods to let clients check their own validity in the context of this license. TODO(miku): Only once method is required: Covers.

type ParseError added in v0.1.75

type ParseError struct {
	Errors []error
}

ParseError collects unmarshal errors.

func (ParseError) Error added in v0.1.75

func (e ParseError) Error() string

Error returns the number of errors encountered.

type Signature added in v0.1.75

type Signature struct {
	Date   string
	Volume string
	Issue  string
}

Signature is a bag of information of the record from which coverage can be determined. Date should comparable strings, like 2010 or 2010-12-21. The volume and issue are parsed as ints, with noise allowed, like "Vol. 1".

func (Signature) IssueInt added in v0.1.75

func (s Signature) IssueInt() int

IssueInt returns the issue as int in a best effort manner.

func (Signature) String added in v0.1.120

func (s Signature) String() string

func (Signature) Time added in v0.1.75

func (s Signature) Time() (time.Time, error)

Time returns a time value, if it is possible to parse it. Otherwise ErrUnparsedTime is returned. Extend datePatterns if necessary.

func (Signature) VolumeInt added in v0.1.75

func (s Signature) VolumeInt() int

VolumeInt returns the Volume in a best effort manner.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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