pub enum Namespace {
Sqlite,
Postgres,
Mysql,
Mongo,
Graphql,
}Expand description
One face a vocabulary has: four databases and the wire.
A namespace is not merely a place a name is written — it is the TYPE the name is carried as, so
that a conversion out of one cannot be handed a name from another. ingraph’s name module
carries the five types and the argument for them.
Variants§
Sqlite
SQLite’s stored word.
Postgres
PostgreSQL’s stored word.
Mysql
MySQL’s stored word.
Mongo
MongoDB’s stored word.
Graphql
The member a GraphQL enum exposes.
Implementations§
Source§impl Namespace
impl Namespace
Sourcepub const fn as_str(self) -> &'static str
pub const fn as_str(self) -> &'static str
The word a declaration writes for this namespace’s block.
Sourcepub const fn database(self) -> Option<DatabaseKind>
pub const fn database(self) -> Option<DatabaseKind>
The database this namespace belongs to, or nothing for the wire.
Sourcepub const fn default_form(self) -> StorageForm
pub const fn default_form(self) -> StorageForm
The form this namespace takes when a declaration says nothing.
Storage is for machines and a schema is for people, which is the whole of the split: a column holds the discriminant, and the wire holds the name.
Sourcepub const fn name_type(self) -> &'static str
pub const fn name_type(self) -> &'static str
This namespace’s name TYPE, on ingraph’s name shelf.
Sourcepub fn accessor(self) -> Ident
pub fn accessor(self) -> Ident
The accessor a TEXT face gets — as_sqlite_str, as_graphql_str.
Mechanical from as_str, which is the word the declaration writes, so the
block a reader wrote and the method they reach for cannot drift apart.
Sourcepub fn default_name(self, canonical: &str) -> String
pub fn default_name(self, canonical: &str) -> String
The word this namespace spells canonical as when the declaration renamed nothing.
Verbatim for a stored word and SHOUTED for the wire. The asymmetry is the ecosystem’s rather
than this crate’s: a GraphQL enum’s members are SCREAMING_SNAKE_CASE by convention, so a face
spelling one Vp9 would be the one schema that did not. A stored word has no such convention,
and a mangling rule that changed here would rewrite somebody’s rows.
The agreement that round owed is PAID, and paid by construction rather than by a pin: the
GraphQL face [wire] emits reads EnumVariant::name under Namespace::Graphql, which is
this function, so the word as_graphql_str hands a caller and the value a client writes are one
string from one table. There is no second casing rule to disagree with heck’s, because there
is no derive applying one — the face is written out. rename is the escape from either.