bookclerk_resolve::kinds
Closed vocabularies of the library data model.
Each enum is matched exhaustively in Rust, carried as a capnp enum on the
plugin wire, and stored as text under a CHECK constraint in SQL. The
as_str spellings are those stored values; a new
variant is appended to all three at once.
| Item | Kind | Summary |
|---|---|---|
WorkKind |
enum | What family of creative work a work is (works.kind). |
ExpressionKind |
enum | How a work is realised (expressions.kind). |
MediaKind |
enum | Carrier of an edition (editions.media_kind). |
Abridgement |
enum | Whether an expression is abridged (expressions.abridgement). |
IdentifierScheme |
enum | Scheme of an external identifier; it fixes level and strength. |
Strength |
enum | Whether an edition identifier names exactly one edition. |
Level |
enum | The bibliographic level a credit or identifier attaches to. |
CreditRole |
enum | What a contributor did (credits.role). |
Entitlement |
enum | How a holder came to own a listing (holdings.entitlement). |
sql_check_list |
function | SQL CHECK list of an enum's stored values: 'a', 'b', 'c'. |
pub enum WorkKind {
Book,
Podcast,
}
What family of creative work a work is (works.kind).
Whether a podcast work is a show or an episode is structural: an
episode has a parent work (works.parent_work_id), a show has none.
Variants
Book: A book, in any expression and on any carrier.Podcast: A podcast: the show, or one episode of it when it has a parent.
pub const ALL: &'static [Self] = _
Every variant, in declaration order.
pub const fn as_str(self) -> &'static str
The text stored for this value in SQL.
pub fn parse(text: &str) -> Option<Self>
Parses a stored value; None for text that names no variant.
Implements: Clone, Copy, Debug, Display, Eq, Hash, Ord, PartialEq, PartialOrd
pub enum ExpressionKind {
Text,
Narration,
Dramatisation,
Graphic,
OriginalAudio,
}
How a work is realised (expressions.kind).
A translation is not a kind: the expression's language and its translator credits say it.
Variants
Text: The written text, as sold in print and ebook editions.Narration: A reading of the text by one or more narrators.Dramatisation: A full-cast dramatisation or performance.Graphic: Sequential art: comics, graphic novels, manga.OriginalAudio: Audio that is itself the first realisation: podcast episodes, lectures, single-voice originals.
pub const ALL: &'static [Self] = _
Every variant, in declaration order.
pub const fn as_str(self) -> &'static str
The text stored for this value in SQL.
pub fn parse(text: &str) -> Option<Self>
Parses a stored value; None for text that names no variant.
Implements: Clone, Copy, Debug, Display, Eq, Hash, Ord, PartialEq, PartialOrd
pub enum MediaKind {
Audio,
Ebook,
Print,
}
Carrier of an edition (editions.media_kind).
Variants
Audio: Downloadable audio: audiobooks and podcast episodes.Ebook: A downloadable document: EPUB, PDF, CBZ and similar.Print: A printed edition.
pub const ALL: &'static [Self] = _
Every variant, in declaration order.
pub const fn as_str(self) -> &'static str
The text stored for this value in SQL.
pub fn parse(text: &str) -> Option<Self>
Parses a stored value; None for text that names no variant.
pub const fn acquirable(self) -> bool
Whether the host acquires editions of this carrier today.
Implements: Clone, Copy, Debug, Display, Eq, Hash, Ord, PartialEq, PartialOrd
pub enum Abridgement {
Unknown,
Unabridged,
Abridged,
}
Whether an expression is abridged (expressions.abridgement).
Variants
Unknown: The source did not say. Never matches any value, itself included.Unabridged: The full text.Abridged: A shortened text.
pub const ALL: &'static [Self] = _
Every variant, in declaration order.
pub const fn as_str(self) -> &'static str
The text stored for this value in SQL.
pub fn parse(text: &str) -> Option<Self>
Parses a stored value; None for text that names no variant.
Implements: Clone, Copy, Debug, Display, Eq, Hash, Ord, PartialEq, PartialOrd
pub enum IdentifierScheme {
Isbn,
Asin,
OpenLibraryEdition,
OpenLibraryWork,
}
Scheme of an external identifier; it fixes level and strength.
Variants
Isbn: ISBN, normalised to ISBN-13; a weak edition identifier.Asin: Amazon ASIN in one marketplace; a strong edition identifier.OpenLibraryEdition: OpenLibrary edition id (OL…M); a strong edition identifier.OpenLibraryWork: OpenLibrary work id (OL…W); names a work.
pub const ALL: &'static [Self] = _
Every variant, in declaration order.
pub const fn as_str(self) -> &'static str
The text stored for this value in SQL.
pub fn parse(text: &str) -> Option<Self>
Parses a stored value; None for text that names no variant.
pub const fn level(self) -> Level
The level whose identifier table this scheme lands in.
pub const fn strength(self) -> Strength
Whether an edition identifier of this scheme is strong or weak.
Work identifiers report [Strength::Strong]: one names one work.
pub const fn marketplace_scoped(self) -> bool
Whether a value of this scheme is scoped to a marketplace.
Implements: Clone, Copy, Debug, Display, Eq, Hash, Ord, PartialEq, PartialOrd
pub enum Strength {
Strong,
Weak,
}
Whether an edition identifier names exactly one edition.
Variants
Strong: Names exactly one edition; unique across the library.Weak: Shared in practice; only proposes a candidate edition.
pub const ALL: &'static [Self] = _
Every variant, in declaration order.
pub const fn as_str(self) -> &'static str
The text stored for this value in SQL.
pub fn parse(text: &str) -> Option<Self>
Parses a stored value; None for text that names no variant.
Implements: Clone, Copy, Debug, Display, Eq, Hash, Ord, PartialEq, PartialOrd
pub enum Level {
Work,
Expression,
Edition,
}
The bibliographic level a credit or identifier attaches to.
Variants
Work: The work.Expression: The expression.Edition: The edition.
pub const ALL: &'static [Self] = _
Every variant, in declaration order.
pub const fn as_str(self) -> &'static str
The text stored for this value in SQL.
pub fn parse(text: &str) -> Option<Self>
Parses a stored value; None for text that names no variant.
Implements: Clone, Copy, Debug, Display, Eq, Hash, Ord, PartialEq, PartialOrd
pub enum CreditRole {
Author,
Narrator,
Translator,
Editor,
Illustrator,
Publisher,
Host,
Cast,
Adaptor,
}
What a contributor did (credits.role).
Variants
Author: Wrote the work.Narrator: Reads the text in a narration.Translator: Translated the text.Editor: Edited the work or edition.Illustrator: Illustrated the work or edition.Publisher: Published the edition.Host: Hosts a podcast.Cast: Performs a part in a dramatisation.Adaptor: Adapted the work into a dramatisation.
pub const ALL: &'static [Self] = _
Every variant, in declaration order.
pub const fn as_str(self) -> &'static str
The text stored for this value in SQL.
pub fn parse(text: &str) -> Option<Self>
Parses a stored value; None for text that names no variant.
pub const fn default_level(self) -> Level
The level this role attaches to unless a source says otherwise.
Implements: Clone, Copy, Debug, Display, Eq, Hash, Ord, PartialEq, PartialOrd
pub enum Entitlement {
Purchase,
Plus,
Loan,
Free,
Own,
}
How a holder came to own a listing (holdings.entitlement).
Variants
Purchase: Bought outright.Plus: Included with a store membership while it lasts.Loan: Borrowed for a time.Free: Given away by the store.Own: The holder's own copy, uploaded by them rather than bought from a store (acore.importlisting).
pub const ALL: &'static [Self] = _
Every variant, in declaration order.
pub const fn as_str(self) -> &'static str
The text stored for this value in SQL.
pub fn parse(text: &str) -> Option<Self>
Parses a stored value; None for text that names no variant.
Implements: Clone, Copy, Debug, Display, Eq, Hash, Ord, PartialEq, PartialOrd
pub fn sql_check_list(values: impl IntoIterator<Item = &'static str>) -> String
SQL CHECK list of an enum's stored values: 'a', 'b', 'c'.
values- The stored spellings, usuallyEnum::ALLmapped throughas_str.
The comma-separated, single-quoted list for an IN (…) clause.
Generated from crates/bookclerk-resolve at main · View as Markdown