Documentation ¶
Index ¶
- Constants
- Variables
- type AgentContribution
- type Character
- type Corporation
- type Dewey
- type Error
- type Image
- type Persistable
- type Person
- type Publication
- type PublicationContribution
- type Publisher
- type PublisherPublication
- type Relation
- type RelationExp
- type Resource
- type ResourceText
- type ResourceType
- type SimpleResource
- type YearRange
Constants ¶
const ( CodeInternal = "internal" // 500 catch-all "our" errors CodeConflict = "conflict" // 409 CodeInvalid = "invalid" // 400 user errors CodeNotFound = "not_found" // 404 )
Application error codes, which map nicely to http status codes
Variables ¶
var ( ErrInternal = Error{Code: CodeInternal} ErrConflict = Error{Code: CodeConflict} ErrInvalid = Error{Code: CodeInvalid} ErrNotFound = Error{Code: CodeNotFound} )
var GetNewID func() string = shortid.MustGenerate
GetNewID returns a new string ID which can be used to persist a new Resource to DB. NOTE: Currently this is a variable so that it can be overwritten with a
deterministic function for test purposes. TODO revise.
Functions ¶
This section is empty.
Types ¶
type AgentContribution ¶
type AgentContribution struct { SimpleResource Year int // TODO publication year or first published year? Roles []marc.Relator }
AgentContribution is a contribution from the viewpoint of an Agent (Person|Corporation).
type Character ¶
type Character struct { Name string `json:"name"` NameVariations []string `json:"name_variations"` }
Character is a fictional or mythical person/character. Examples: Ulysses, Apollon, Zevs, Donald Duck, Harry Hole
type Corporation ¶
type Corporation struct { YearRange YearRange `json:"year_range"` Name string `json:"name"` Description string `json:"description"` ParentName string `json:"parent_name,omitempty"` NameVariations []string `json:"name_variations"` Notes []string `json:"notes"` }
Corporation TODO rename Organization?
func (Corporation) Label ¶
func (c Corporation) Label() string
type Dewey ¶
type Persistable ¶
type Persistable interface { Validate(url.Values) (Persistable, bool) Label() string }
type Person ¶
type Person struct { YearRange YearRange `json:"year_range"` // TODO pointer *YearRange? Name string `json:"name"` Description string `json:"description"` NameVariations []string `json:"name_variations"` Gender vocab.Gender `json:"gender"` Countries []string `json:"countries"` Nationalities []string `json:"nationalities"` Notes []string `json:"notes"` }
type Publication ¶
type Publication struct { // Title and publishing info Title string `json:"title"` Subtitle string `json:"subtitle,omitempty"` Series []string `json:"series"` // Note, Year|YearFirst=0 means we cannot have a publication published in year 0, // assumed this to be not a practical problem, not a lot of known classics published that year (TODO any?) // https://en.wikipedia.org/wiki/Ancient_literature Year json.Number `json:"year,omitempty"` // "Work" / orignal title info // WorkRepresentative bool / WorkExample - prefer first edition in original language // WorkClassic bool // homer, bible, pre 1500 books etc YearFirst json.Number `json:"year_first,omitempty"` TitleOriginal string `json:"title_original,omitempty"` LanguageOriginal string `json:"language_original,omitempty"` // Content info Language string `json:"language,omitempty"` LanguagesOther []string `json:"languages_other"` GenreForms []string `json:"genre_forms"` Audiences []string `json:"audiences"` Fiction bool `json:"fiction"` Nonfiction bool `json:"nonfiction"` Subjects []string // Physical info Binding vocab.Binding `json:"binding"` // hardcover, paperback, innbundet, heftet etc... NumPages json.Number `json:"numpages,omitempty"` }
func (Publication) Label ¶
func (p Publication) Label() string
TODO how to get author into the picture?
type PublicationContribution ¶
type PublicationContribution struct { Agent SimpleResource Roles []marc.Relator }
PublicationContribution is a contribution from the view point of a Publication.
type Publisher ¶
type PublisherPublication ¶
type PublisherPublication struct { SimpleResource Year int }
type RelationExp ¶
type RelationExp struct { Relation Label string From SimpleResource To SimpleResource }
type Resource ¶
type ResourceText ¶
type ResourceType ¶
type ResourceType int
const ( // TODO consider string consts instead TypeUnknown ResourceType = iota TypePublication TypePublisher TypePerson TypeCorporation TypeLiteraryAward TypeSeries TypeDewey )
func AllResourceTypes ¶
func AllResourceTypes() []ResourceType
func ParseResourceType ¶
func ParseResourceType(s string) ResourceType
func (ResourceType) Label ¶
func (r ResourceType) Label(tag language.Tag) string
Label returns a localized string representation of ResourceType.
func (ResourceType) String ¶
func (r ResourceType) String() string
type SimpleResource ¶
type SimpleResource struct { Type ResourceType ID string Label string }
SimpleResource is a minimal representation of a Resource that can be displayed and referenced to (i.e generate a URL/link from type+ID). If ID is empty it is not persisted or intended for persistence.
type YearRange ¶
type YearRange struct { From json.Number `json:"from,omitempty"` To json.Number `json:"to,omitempty"` Approx bool `json:"approx"` }
YearRange represents a span of years, with a from and to year, and a specification if it is accurate (Approx=false) or approximate (Approx=true). Using json.Number instead of int allow us to distinguish between year 0 and no value. It also simplifies form validation.
Directories ¶
Path | Synopsis |
---|---|
cmd
|
|
package etl
|
package etl |
client
package client TODO rename httpclient?
|
package client TODO rename httpclient? |
internal
|
|
Code generated by go generate; DO NOT EDIT.
|
Code generated by go generate; DO NOT EDIT. |
Package marc implements decoding of MARCXML (MarcXchange (ISO25577) bibliographic MARC records, and convenience methods for extracting values from record fields.
|
Package marc implements decoding of MARCXML (MarcXchange (ISO25577) bibliographic MARC records, and convenience methods for extracting values from record fields. |
iso3166
Code generated by go generate; DO NOT EDIT.
|
Code generated by go generate; DO NOT EDIT. |
iso6393
Code generated by go generate; DO NOT EDIT.
|
Code generated by go generate; DO NOT EDIT. |
rda
Code generated by go generate; DO NOT EDIT.
|
Code generated by go generate; DO NOT EDIT. |