pub enum Stmt {
Query {
nql: String,
project: Vec<Col>,
},
Insert {
coll: String,
rows: Vec<InsertRow>,
returning: Vec<Col>,
},
Update {
coll: String,
set: Vec<(String, Value)>,
nql: String,
returning: Vec<Col>,
},
Delete {
coll: String,
nql: String,
returning: Vec<Col>,
},
Canned {
cols: Vec<String>,
row: Vec<String>,
},
Ok(&'static str),
}Expand description
What a translated statement asks for.
The write variants exist because SQL’s write semantics and NEDB’s storage model line up almost exactly, which was not obvious until it was written down:
| SQL | NEDB |
|---|---|
INSERT | a put |
UPDATE … WHERE | a NEW VERSION of each matching document |
DELETE … WHERE | a tombstone |
NEDB is append-only, so an UPDATE is already a versioned write and a
DELETE is already a tombstone. Nothing is being bent to fit. The
consequence is the thing worth selling: run the SQL you would run against
Postgres, and the tamper-evident history falls out for free — the prior
value is still readable with AS OF SYSTEM TIME.
Variants§
Query
Run this NQL, then project these columns (empty = all).
Insert
INSERT INTO coll (cols) VALUES (…), (…) [RETURNING …]
Update
UPDATE coll SET … [WHERE …] [RETURNING …] — a new version per match.
Delete
DELETE FROM coll [WHERE …] [RETURNING …] — a tombstone per match.
Canned
Answer from a fixed table — the handshake queries clients send on connect.
Ok(&'static str)
Nothing to do (empty statement, or a SET the client does not need honoured).
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Stmt
impl RefUnwindSafe for Stmt
impl Send for Stmt
impl Sync for Stmt
impl Unpin for Stmt
impl UnsafeUnpin for Stmt
impl UnwindSafe for Stmt
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<A, B, T> HttpServerConnExec<A, B> for Twhere
B: Body,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more