diff options
author | Martin Czygan <martin.czygan@gmail.com> | 2021-07-27 00:10:20 +0200 |
---|---|---|
committer | Martin Czygan <martin.czygan@gmail.com> | 2021-07-27 00:10:20 +0200 |
commit | 715aa435b7d12265cbc041fff126bc1f9f653984 (patch) | |
tree | 55e5b7e13f595ce0907433b3c129d541b2ebf1b4 | |
parent | 613cb747b08d80546698633321cca274e6b008da (diff) | |
download | refcat-715aa435b7d12265cbc041fff126bc1f9f653984.tar.gz refcat-715aa435b7d12265cbc041fff126bc1f9f653984.zip |
cleanup and docs
-rw-r--r-- | skate/schema.go | 29 |
1 files changed, 4 insertions, 25 deletions
diff --git a/skate/schema.go b/skate/schema.go index b69f206..7717f9f 100644 --- a/skate/schema.go +++ b/skate/schema.go @@ -512,8 +512,10 @@ func (b *BiblioRef) Reset() { b.TargetCSL = nil } -// Hash returns a string that will be the same, if source and target are -// equal; different otherwise. This can be used to detect duplicate links. +// LinkHash returns a string that will be the same, if source and target are +// equal; different otherwise. This can be used to detect duplicate links. This +// should always return a non-empty string, but would return an empty string, +// if it would fail. func (b *BiblioRef) LinkHash() string { switch { case b.SourceReleaseIdent != "" && b.TargetReleaseIdent != "": @@ -540,29 +542,6 @@ func (b *BiblioRef) LinkHash() string { } } -// ReleaseCluster, a list of match candidates. This is typically serialized as a -// single JSON line containing the match key and a list of release documents. -// -// Deprecated, since we are moving to a "two stream" generic "join" style -// processing. -type ReleaseCluster struct { - Key string `json:"k"` - Values []*Release `json:"v"` -} - -// OneNonRef returns the first non-reference release found in a cluster, or an -// error, if none has been found. This depends on converted references setting -// extra.skate.status to "ref" - we use this in mixed clusters (catalog entries -// and references converted into releases). -func (rc *ReleaseCluster) OneNonRef() (*Release, error) { - for _, re := range rc.Values { - if re.Extra.Skate.Status != "ref" { - return re, nil - } - } - return nil, fmt.Errorf("no reference/release found for cluster key: %v", rc.Key) -} - // MinimalCitations variant from // archive.org/details/wikipedia_citations_2020-07-14. Part of the naming was // already inconsistent. |