Simplify datastore keys
This commit is contained in:
parent
77844ab06b
commit
438b1d759c
21 changed files with 296 additions and 252 deletions
|
@ -1,15 +1,14 @@
|
||||||
use crate::err::Error;
|
use crate::err::Error;
|
||||||
use crate::key::bytes::{deserialize, serialize};
|
use crate::key::bytes::{deserialize, serialize};
|
||||||
use crate::key::BASE;
|
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
#[derive(Clone, Debug, Eq, PartialEq, PartialOrd, Serialize, Deserialize)]
|
#[derive(Clone, Debug, Eq, PartialEq, PartialOrd, Serialize, Deserialize)]
|
||||||
pub struct Database {
|
pub struct Database {
|
||||||
kv: String,
|
__: char,
|
||||||
_a: String,
|
_a: char,
|
||||||
ns: String,
|
pub ns: String,
|
||||||
_b: String,
|
_b: char,
|
||||||
db: String,
|
pub db: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<Database> for Vec<u8> {
|
impl From<Database> for Vec<u8> {
|
||||||
|
@ -31,10 +30,10 @@ pub fn new(ns: &str, db: &str) -> Database {
|
||||||
impl Database {
|
impl Database {
|
||||||
pub fn new(ns: String, db: String) -> Database {
|
pub fn new(ns: String, db: String) -> Database {
|
||||||
Database {
|
Database {
|
||||||
kv: BASE.to_owned(),
|
__: '/',
|
||||||
_a: String::from("*"),
|
_a: '*',
|
||||||
ns,
|
ns,
|
||||||
_b: String::from("*"),
|
_b: '*',
|
||||||
db,
|
db,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,15 +1,16 @@
|
||||||
use crate::err::Error;
|
use crate::err::Error;
|
||||||
use crate::key::bytes::{deserialize, serialize};
|
use crate::key::bytes::{deserialize, serialize};
|
||||||
use crate::key::BASE;
|
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
#[derive(Clone, Debug, Eq, PartialEq, PartialOrd, Serialize, Deserialize)]
|
#[derive(Clone, Debug, Eq, PartialEq, PartialOrd, Serialize, Deserialize)]
|
||||||
pub struct Db {
|
pub struct Db {
|
||||||
kv: String,
|
__: char,
|
||||||
_a: String,
|
_a: char,
|
||||||
ns: String,
|
pub ns: String,
|
||||||
_b: String,
|
_b: char,
|
||||||
db: String,
|
_c: char,
|
||||||
|
_d: char,
|
||||||
|
pub db: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<Db> for Vec<u8> {
|
impl From<Db> for Vec<u8> {
|
||||||
|
@ -31,10 +32,12 @@ pub fn new(ns: &str, db: &str) -> Db {
|
||||||
impl Db {
|
impl Db {
|
||||||
pub fn new(ns: String, db: String) -> Db {
|
pub fn new(ns: String, db: String) -> Db {
|
||||||
Db {
|
Db {
|
||||||
kv: BASE.to_owned(),
|
__: '/',
|
||||||
_a: String::from("*"),
|
_a: '*',
|
||||||
ns,
|
ns,
|
||||||
_b: String::from("!db"),
|
_b: '!',
|
||||||
|
_c: 'd',
|
||||||
|
_d: 'b',
|
||||||
db,
|
db,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,17 +1,18 @@
|
||||||
use crate::err::Error;
|
use crate::err::Error;
|
||||||
use crate::key::bytes::{deserialize, serialize};
|
use crate::key::bytes::{deserialize, serialize};
|
||||||
use crate::key::BASE;
|
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
#[derive(Clone, Debug, Eq, PartialEq, PartialOrd, Serialize, Deserialize)]
|
#[derive(Clone, Debug, Eq, PartialEq, PartialOrd, Serialize, Deserialize)]
|
||||||
pub struct Dl {
|
pub struct Dl {
|
||||||
kv: String,
|
__: char,
|
||||||
_a: String,
|
_a: char,
|
||||||
ns: String,
|
pub ns: String,
|
||||||
_b: String,
|
_b: char,
|
||||||
db: String,
|
pub db: String,
|
||||||
_c: String,
|
_c: char,
|
||||||
us: String,
|
_d: char,
|
||||||
|
_e: char,
|
||||||
|
pub dl: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<Dl> for Vec<u8> {
|
impl From<Dl> for Vec<u8> {
|
||||||
|
@ -26,20 +27,22 @@ impl From<Vec<u8>> for Dl {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn new(ns: &str, db: &str, us: &str) -> Dl {
|
pub fn new(ns: &str, db: &str, dl: &str) -> Dl {
|
||||||
Dl::new(ns.to_string(), db.to_string(), us.to_string())
|
Dl::new(ns.to_string(), db.to_string(), dl.to_string())
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Dl {
|
impl Dl {
|
||||||
pub fn new(ns: String, db: String, us: String) -> Dl {
|
pub fn new(ns: String, db: String, dl: String) -> Dl {
|
||||||
Dl {
|
Dl {
|
||||||
kv: BASE.to_owned(),
|
__: '/',
|
||||||
_a: String::from("*"),
|
_a: '*',
|
||||||
ns,
|
ns,
|
||||||
_b: String::from("*"),
|
_b: '*',
|
||||||
db,
|
db,
|
||||||
_c: String::from("!us"),
|
_c: '!',
|
||||||
us,
|
_d: 'd',
|
||||||
|
_e: 'l',
|
||||||
|
dl,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
pub fn encode(&self) -> Result<Vec<u8>, Error> {
|
pub fn encode(&self) -> Result<Vec<u8>, Error> {
|
||||||
|
|
|
@ -1,17 +1,18 @@
|
||||||
use crate::err::Error;
|
use crate::err::Error;
|
||||||
use crate::key::bytes::{deserialize, serialize};
|
use crate::key::bytes::{deserialize, serialize};
|
||||||
use crate::key::BASE;
|
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
#[derive(Clone, Debug, Eq, PartialEq, PartialOrd, Serialize, Deserialize)]
|
#[derive(Clone, Debug, Eq, PartialEq, PartialOrd, Serialize, Deserialize)]
|
||||||
pub struct Dt {
|
pub struct Dt {
|
||||||
kv: String,
|
__: char,
|
||||||
_a: String,
|
_a: char,
|
||||||
ns: String,
|
pub ns: String,
|
||||||
_b: String,
|
_b: char,
|
||||||
db: String,
|
pub db: String,
|
||||||
_c: String,
|
_c: char,
|
||||||
tk: String,
|
_d: char,
|
||||||
|
_e: char,
|
||||||
|
pub tk: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<Dt> for Vec<u8> {
|
impl From<Dt> for Vec<u8> {
|
||||||
|
@ -33,12 +34,14 @@ pub fn new(ns: &str, db: &str, tb: &str) -> Dt {
|
||||||
impl Dt {
|
impl Dt {
|
||||||
pub fn new(ns: String, db: String, tk: String) -> Dt {
|
pub fn new(ns: String, db: String, tk: String) -> Dt {
|
||||||
Dt {
|
Dt {
|
||||||
kv: BASE.to_owned(),
|
__: '/',
|
||||||
_a: String::from("*"),
|
_a: '*',
|
||||||
ns,
|
ns,
|
||||||
_b: String::from("*"),
|
_b: '*',
|
||||||
db,
|
db,
|
||||||
_c: String::from("!tk"),
|
_c: '!',
|
||||||
|
_d: 'd',
|
||||||
|
_e: 't',
|
||||||
tk,
|
tk,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,19 +1,20 @@
|
||||||
use crate::err::Error;
|
use crate::err::Error;
|
||||||
use crate::key::bytes::{deserialize, serialize};
|
use crate::key::bytes::{deserialize, serialize};
|
||||||
use crate::key::BASE;
|
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
#[derive(Clone, Debug, Eq, PartialEq, PartialOrd, Serialize, Deserialize)]
|
#[derive(Clone, Debug, Eq, PartialEq, PartialOrd, Serialize, Deserialize)]
|
||||||
pub struct Ev {
|
pub struct Ev {
|
||||||
kv: String,
|
__: char,
|
||||||
_a: String,
|
_a: char,
|
||||||
ns: String,
|
pub ns: String,
|
||||||
_b: String,
|
_b: char,
|
||||||
db: String,
|
pub db: String,
|
||||||
_c: String,
|
_c: char,
|
||||||
tb: String,
|
pub tb: String,
|
||||||
_d: String,
|
_d: char,
|
||||||
ev: String,
|
_e: char,
|
||||||
|
_f: char,
|
||||||
|
pub ev: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<Ev> for Vec<u8> {
|
impl From<Ev> for Vec<u8> {
|
||||||
|
@ -35,14 +36,16 @@ pub fn new(ns: &str, db: &str, tb: &str, ev: &str) -> Ev {
|
||||||
impl Ev {
|
impl Ev {
|
||||||
pub fn new(ns: String, db: String, tb: String, ev: String) -> Ev {
|
pub fn new(ns: String, db: String, tb: String, ev: String) -> Ev {
|
||||||
Ev {
|
Ev {
|
||||||
kv: BASE.to_owned(),
|
__: '/',
|
||||||
_a: String::from("*"),
|
_a: '*',
|
||||||
ns,
|
ns,
|
||||||
_b: String::from("*"),
|
_b: '*',
|
||||||
db,
|
db,
|
||||||
_c: String::from("*"),
|
_c: '*',
|
||||||
tb,
|
tb,
|
||||||
_d: String::from("!ev"),
|
_d: '!',
|
||||||
|
_e: 'e',
|
||||||
|
_f: 'v',
|
||||||
ev,
|
ev,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,19 +1,20 @@
|
||||||
use crate::err::Error;
|
use crate::err::Error;
|
||||||
use crate::key::bytes::{deserialize, serialize};
|
use crate::key::bytes::{deserialize, serialize};
|
||||||
use crate::key::BASE;
|
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
#[derive(Clone, Debug, Eq, PartialEq, PartialOrd, Serialize, Deserialize)]
|
#[derive(Clone, Debug, Eq, PartialEq, PartialOrd, Serialize, Deserialize)]
|
||||||
pub struct Fd {
|
pub struct Fd {
|
||||||
kv: String,
|
__: char,
|
||||||
_a: String,
|
_a: char,
|
||||||
ns: String,
|
pub ns: String,
|
||||||
_b: String,
|
_b: char,
|
||||||
db: String,
|
pub db: String,
|
||||||
_c: String,
|
_c: char,
|
||||||
tb: String,
|
pub tb: String,
|
||||||
_d: String,
|
_d: char,
|
||||||
fd: String,
|
_e: char,
|
||||||
|
_f: char,
|
||||||
|
pub fd: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<Fd> for Vec<u8> {
|
impl From<Fd> for Vec<u8> {
|
||||||
|
@ -35,14 +36,16 @@ pub fn new(ns: &str, db: &str, tb: &str, fd: &str) -> Fd {
|
||||||
impl Fd {
|
impl Fd {
|
||||||
pub fn new(ns: String, db: String, tb: String, fd: String) -> Fd {
|
pub fn new(ns: String, db: String, tb: String, fd: String) -> Fd {
|
||||||
Fd {
|
Fd {
|
||||||
kv: BASE.to_owned(),
|
__: '/',
|
||||||
_a: String::from("*"),
|
_a: '*',
|
||||||
ns,
|
ns,
|
||||||
_b: String::from("*"),
|
_b: '*',
|
||||||
db,
|
db,
|
||||||
_c: String::from("*"),
|
_c: '*',
|
||||||
tb,
|
tb,
|
||||||
_d: String::from("!fd"),
|
_d: '!',
|
||||||
|
_e: 'f',
|
||||||
|
_f: 'd',
|
||||||
fd,
|
fd,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,19 +1,20 @@
|
||||||
use crate::err::Error;
|
use crate::err::Error;
|
||||||
use crate::key::bytes::{deserialize, serialize};
|
use crate::key::bytes::{deserialize, serialize};
|
||||||
use crate::key::BASE;
|
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
#[derive(Clone, Debug, Eq, PartialEq, PartialOrd, Serialize, Deserialize)]
|
#[derive(Clone, Debug, Eq, PartialEq, PartialOrd, Serialize, Deserialize)]
|
||||||
pub struct Ft {
|
pub struct Ft {
|
||||||
kv: String,
|
__: char,
|
||||||
_a: String,
|
_a: char,
|
||||||
ns: String,
|
pub ns: String,
|
||||||
_b: String,
|
_b: char,
|
||||||
db: String,
|
pub db: String,
|
||||||
_d: String,
|
_c: char,
|
||||||
tb: String,
|
pub tb: String,
|
||||||
_c: String,
|
_d: char,
|
||||||
ft: String,
|
_e: char,
|
||||||
|
_f: char,
|
||||||
|
pub ft: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<Ft> for Vec<u8> {
|
impl From<Ft> for Vec<u8> {
|
||||||
|
@ -35,14 +36,16 @@ pub fn new(ns: &str, db: &str, tb: &str, ft: &str) -> Ft {
|
||||||
impl Ft {
|
impl Ft {
|
||||||
pub fn new(ns: String, db: String, tb: String, ft: String) -> Ft {
|
pub fn new(ns: String, db: String, tb: String, ft: String) -> Ft {
|
||||||
Ft {
|
Ft {
|
||||||
kv: BASE.to_owned(),
|
__: '/',
|
||||||
_a: String::from("*"),
|
_a: '*',
|
||||||
ns,
|
ns,
|
||||||
_b: String::from("*"),
|
_b: '*',
|
||||||
db,
|
db,
|
||||||
_c: String::from("*"),
|
_c: '*',
|
||||||
tb,
|
tb,
|
||||||
_d: String::from("!ft"),
|
_d: '!',
|
||||||
|
_e: 'f',
|
||||||
|
_f: 't',
|
||||||
ft,
|
ft,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,21 +1,20 @@
|
||||||
use crate::err::Error;
|
use crate::err::Error;
|
||||||
use crate::key::bytes::{deserialize, serialize};
|
use crate::key::bytes::{deserialize, serialize};
|
||||||
use crate::key::BASE;
|
|
||||||
use crate::sql::value::Value;
|
use crate::sql::value::Value;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
#[derive(Clone, Debug, Eq, PartialEq, PartialOrd, Serialize, Deserialize)]
|
#[derive(Clone, Debug, Eq, PartialEq, PartialOrd, Serialize, Deserialize)]
|
||||||
pub struct Index {
|
pub struct Index {
|
||||||
kv: String,
|
__: char,
|
||||||
_a: String,
|
_a: char,
|
||||||
ns: String,
|
pub ns: String,
|
||||||
_b: String,
|
_b: char,
|
||||||
db: String,
|
pub db: String,
|
||||||
_c: String,
|
_c: char,
|
||||||
tb: String,
|
pub tb: String,
|
||||||
_d: String,
|
_d: char,
|
||||||
ix: String,
|
pub ix: String,
|
||||||
fd: Value,
|
pub fd: Value,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<Index> for Vec<u8> {
|
impl From<Index> for Vec<u8> {
|
||||||
|
@ -37,14 +36,14 @@ pub fn new(ns: &str, db: &str, tb: &str, ix: &str, fd: Value) -> Index {
|
||||||
impl Index {
|
impl Index {
|
||||||
pub fn new(ns: String, db: String, tb: String, ix: String, fd: Value) -> Index {
|
pub fn new(ns: String, db: String, tb: String, ix: String, fd: Value) -> Index {
|
||||||
Index {
|
Index {
|
||||||
kv: BASE.to_owned(),
|
__: '/',
|
||||||
_a: String::from("*"),
|
_a: '*',
|
||||||
ns,
|
ns,
|
||||||
_b: String::from("*"),
|
_b: '*',
|
||||||
db,
|
db,
|
||||||
_c: String::from("*"),
|
_c: '*',
|
||||||
tb,
|
tb,
|
||||||
_d: String::from("¤"),
|
_d: '¤',
|
||||||
ix,
|
ix,
|
||||||
fd,
|
fd,
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,19 +1,20 @@
|
||||||
use crate::err::Error;
|
use crate::err::Error;
|
||||||
use crate::key::bytes::{deserialize, serialize};
|
use crate::key::bytes::{deserialize, serialize};
|
||||||
use crate::key::BASE;
|
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
#[derive(Clone, Debug, Eq, PartialEq, PartialOrd, Serialize, Deserialize)]
|
#[derive(Clone, Debug, Eq, PartialEq, PartialOrd, Serialize, Deserialize)]
|
||||||
pub struct Ix {
|
pub struct Ix {
|
||||||
kv: String,
|
__: char,
|
||||||
_a: String,
|
_a: char,
|
||||||
ns: String,
|
pub ns: String,
|
||||||
_b: String,
|
_b: char,
|
||||||
db: String,
|
pub db: String,
|
||||||
_c: String,
|
_c: char,
|
||||||
tb: String,
|
pub tb: String,
|
||||||
_d: String,
|
_d: char,
|
||||||
ix: String,
|
_e: char,
|
||||||
|
_f: char,
|
||||||
|
pub ix: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<Ix> for Vec<u8> {
|
impl From<Ix> for Vec<u8> {
|
||||||
|
@ -35,14 +36,16 @@ pub fn new(ns: &str, db: &str, tb: &str, ix: &str) -> Ix {
|
||||||
impl Ix {
|
impl Ix {
|
||||||
pub fn new(ns: String, db: String, tb: String, ix: String) -> Ix {
|
pub fn new(ns: String, db: String, tb: String, ix: String) -> Ix {
|
||||||
Ix {
|
Ix {
|
||||||
kv: BASE.to_owned(),
|
__: '/',
|
||||||
_a: String::from("*"),
|
_a: '*',
|
||||||
ns,
|
ns,
|
||||||
_b: String::from("*"),
|
_b: '*',
|
||||||
db,
|
db,
|
||||||
_c: String::from("*"),
|
_c: '*',
|
||||||
tb,
|
tb,
|
||||||
_d: String::from("!ix"),
|
_d: '!',
|
||||||
|
_e: 'i',
|
||||||
|
_f: 'x',
|
||||||
ix,
|
ix,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,8 +3,6 @@ use crate::err::Error;
|
||||||
use crate::key::bytes::{deserialize, serialize};
|
use crate::key::bytes::{deserialize, serialize};
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
// Default base key
|
|
||||||
pub const BASE: &str = "surreal";
|
|
||||||
// Ignore specifies an ignored field
|
// Ignore specifies an ignored field
|
||||||
pub const IGNORE: &str = "\x00";
|
pub const IGNORE: &str = "\x00";
|
||||||
// Prefix is the lowest char found in a key
|
// Prefix is the lowest char found in a key
|
||||||
|
|
|
@ -1,19 +1,20 @@
|
||||||
use crate::err::Error;
|
use crate::err::Error;
|
||||||
use crate::key::bytes::{deserialize, serialize};
|
use crate::key::bytes::{deserialize, serialize};
|
||||||
use crate::key::BASE;
|
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
#[derive(Clone, Debug, Eq, PartialEq, PartialOrd, Serialize, Deserialize)]
|
#[derive(Clone, Debug, Eq, PartialEq, PartialOrd, Serialize, Deserialize)]
|
||||||
pub struct Lv {
|
pub struct Lv {
|
||||||
kv: String,
|
__: char,
|
||||||
_a: String,
|
_a: char,
|
||||||
ns: String,
|
pub ns: String,
|
||||||
_b: String,
|
_b: char,
|
||||||
db: String,
|
pub db: String,
|
||||||
_c: String,
|
_c: char,
|
||||||
tb: String,
|
pub tb: String,
|
||||||
_d: String,
|
_d: char,
|
||||||
lv: String,
|
_e: char,
|
||||||
|
_f: char,
|
||||||
|
pub lv: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<Lv> for Vec<u8> {
|
impl From<Lv> for Vec<u8> {
|
||||||
|
@ -35,14 +36,16 @@ pub fn new(ns: &str, db: &str, tb: &str, lv: &str) -> Lv {
|
||||||
impl Lv {
|
impl Lv {
|
||||||
pub fn new(ns: String, db: String, tb: String, lv: String) -> Lv {
|
pub fn new(ns: String, db: String, tb: String, lv: String) -> Lv {
|
||||||
Lv {
|
Lv {
|
||||||
kv: BASE.to_owned(),
|
__: '/',
|
||||||
_a: String::from("*"),
|
_a: '*',
|
||||||
ns,
|
ns,
|
||||||
_b: String::from("*"),
|
_b: '*',
|
||||||
db,
|
db,
|
||||||
_c: String::from("*"),
|
_c: '*',
|
||||||
tb,
|
tb,
|
||||||
_d: String::from("!lv"),
|
_d: '!',
|
||||||
|
_e: 'l',
|
||||||
|
_f: 'v',
|
||||||
lv,
|
lv,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,13 +1,12 @@
|
||||||
use crate::err::Error;
|
use crate::err::Error;
|
||||||
use crate::key::bytes::{deserialize, serialize};
|
use crate::key::bytes::{deserialize, serialize};
|
||||||
use crate::key::BASE;
|
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
#[derive(Clone, Debug, Eq, PartialEq, PartialOrd, Serialize, Deserialize)]
|
#[derive(Clone, Debug, Eq, PartialEq, PartialOrd, Serialize, Deserialize)]
|
||||||
pub struct Namespace {
|
pub struct Namespace {
|
||||||
kv: String,
|
__: char,
|
||||||
_a: String,
|
_a: char,
|
||||||
ns: String,
|
pub ns: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<Namespace> for Vec<u8> {
|
impl From<Namespace> for Vec<u8> {
|
||||||
|
@ -29,8 +28,8 @@ pub fn new(ns: &str) -> Namespace {
|
||||||
impl Namespace {
|
impl Namespace {
|
||||||
pub fn new(ns: String) -> Namespace {
|
pub fn new(ns: String) -> Namespace {
|
||||||
Namespace {
|
Namespace {
|
||||||
kv: BASE.to_owned(),
|
__: '/',
|
||||||
_a: String::from("*"),
|
_a: '*',
|
||||||
ns,
|
ns,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,15 +1,16 @@
|
||||||
use crate::err::Error;
|
use crate::err::Error;
|
||||||
use crate::key::bytes::{deserialize, serialize};
|
use crate::key::bytes::{deserialize, serialize};
|
||||||
use crate::key::BASE;
|
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
#[derive(Clone, Debug, Eq, PartialEq, PartialOrd, Serialize, Deserialize)]
|
#[derive(Clone, Debug, Eq, PartialEq, PartialOrd, Serialize, Deserialize)]
|
||||||
pub struct Nl {
|
pub struct Nl {
|
||||||
kv: String,
|
__: char,
|
||||||
_a: String,
|
_a: char,
|
||||||
ns: String,
|
pub ns: String,
|
||||||
_b: String,
|
_b: char,
|
||||||
us: String,
|
_c: char,
|
||||||
|
_d: char,
|
||||||
|
pub us: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<Nl> for Vec<u8> {
|
impl From<Nl> for Vec<u8> {
|
||||||
|
@ -31,10 +32,12 @@ pub fn new(ns: &str, us: &str) -> Nl {
|
||||||
impl Nl {
|
impl Nl {
|
||||||
pub fn new(ns: String, us: String) -> Nl {
|
pub fn new(ns: String, us: String) -> Nl {
|
||||||
Nl {
|
Nl {
|
||||||
kv: BASE.to_owned(),
|
__: '/',
|
||||||
_a: String::from("*"),
|
_a: '*',
|
||||||
ns,
|
ns,
|
||||||
_b: String::from("!us"),
|
_b: '!',
|
||||||
|
_c: 'n',
|
||||||
|
_d: 'l',
|
||||||
us,
|
us,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,13 +1,14 @@
|
||||||
use crate::err::Error;
|
use crate::err::Error;
|
||||||
use crate::key::bytes::{deserialize, serialize};
|
use crate::key::bytes::{deserialize, serialize};
|
||||||
use crate::key::BASE;
|
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
#[derive(Clone, Debug, Eq, PartialEq, PartialOrd, Serialize, Deserialize)]
|
#[derive(Clone, Debug, Eq, PartialEq, PartialOrd, Serialize, Deserialize)]
|
||||||
pub struct Ns {
|
pub struct Ns {
|
||||||
kv: String,
|
__: char,
|
||||||
_a: String,
|
_a: char,
|
||||||
ns: String,
|
_b: char,
|
||||||
|
_c: char,
|
||||||
|
pub ns: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<Ns> for Vec<u8> {
|
impl From<Ns> for Vec<u8> {
|
||||||
|
@ -29,8 +30,10 @@ pub fn new(ns: &str) -> Ns {
|
||||||
impl Ns {
|
impl Ns {
|
||||||
pub fn new(ns: String) -> Ns {
|
pub fn new(ns: String) -> Ns {
|
||||||
Ns {
|
Ns {
|
||||||
kv: BASE.to_owned(),
|
__: '/',
|
||||||
_a: String::from("!ns"),
|
_a: '!',
|
||||||
|
_b: 'n',
|
||||||
|
_c: 's',
|
||||||
ns,
|
ns,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,15 +1,16 @@
|
||||||
use crate::err::Error;
|
use crate::err::Error;
|
||||||
use crate::key::bytes::{deserialize, serialize};
|
use crate::key::bytes::{deserialize, serialize};
|
||||||
use crate::key::BASE;
|
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
#[derive(Clone, Debug, Eq, PartialEq, PartialOrd, Serialize, Deserialize)]
|
#[derive(Clone, Debug, Eq, PartialEq, PartialOrd, Serialize, Deserialize)]
|
||||||
pub struct Nt {
|
pub struct Nt {
|
||||||
kv: String,
|
__: char,
|
||||||
_a: String,
|
_a: char,
|
||||||
ns: String,
|
pub ns: String,
|
||||||
_b: String,
|
_b: char,
|
||||||
tk: String,
|
_c: char,
|
||||||
|
_d: char,
|
||||||
|
pub tk: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<Nt> for Vec<u8> {
|
impl From<Nt> for Vec<u8> {
|
||||||
|
@ -31,10 +32,12 @@ pub fn new(ns: &str, tk: &str) -> Nt {
|
||||||
impl Nt {
|
impl Nt {
|
||||||
pub fn new(ns: String, tk: String) -> Nt {
|
pub fn new(ns: String, tk: String) -> Nt {
|
||||||
Nt {
|
Nt {
|
||||||
kv: BASE.to_owned(),
|
__: '/',
|
||||||
_a: String::from("*"),
|
_a: '*',
|
||||||
ns,
|
ns,
|
||||||
_b: String::from("!tk"),
|
_b: '!',
|
||||||
|
_c: 'n',
|
||||||
|
_d: 't',
|
||||||
tk,
|
tk,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,22 +1,21 @@
|
||||||
use crate::err::Error;
|
use crate::err::Error;
|
||||||
use crate::key::bytes::{deserialize, serialize};
|
use crate::key::bytes::{deserialize, serialize};
|
||||||
use crate::key::BASE;
|
|
||||||
use crate::sql::value::Value;
|
use crate::sql::value::Value;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
#[derive(Clone, Debug, Eq, PartialEq, PartialOrd, Serialize, Deserialize)]
|
#[derive(Clone, Debug, Eq, PartialEq, PartialOrd, Serialize, Deserialize)]
|
||||||
pub struct Point {
|
pub struct Point {
|
||||||
kv: String,
|
__: char,
|
||||||
_a: String,
|
_a: char,
|
||||||
ns: String,
|
pub ns: String,
|
||||||
_b: String,
|
_b: char,
|
||||||
db: String,
|
pub db: String,
|
||||||
_c: String,
|
_c: char,
|
||||||
tb: String,
|
pub tb: String,
|
||||||
_d: String,
|
_d: char,
|
||||||
ix: String,
|
pub ix: String,
|
||||||
fd: Value,
|
pub fd: Value,
|
||||||
id: String,
|
pub id: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<Point> for Vec<u8> {
|
impl From<Point> for Vec<u8> {
|
||||||
|
@ -38,14 +37,14 @@ pub fn new(ns: &str, db: &str, tb: &str, ix: &str, fd: Value, id: &str) -> Point
|
||||||
impl Point {
|
impl Point {
|
||||||
pub fn new(ns: String, db: String, tb: String, ix: String, fd: Value, id: String) -> Point {
|
pub fn new(ns: String, db: String, tb: String, ix: String, fd: Value, id: String) -> Point {
|
||||||
Point {
|
Point {
|
||||||
kv: BASE.to_owned(),
|
__: '/',
|
||||||
_a: String::from("*"),
|
_a: '*',
|
||||||
ns,
|
ns,
|
||||||
_b: String::from("*"),
|
_b: '*',
|
||||||
db,
|
db,
|
||||||
_c: String::from("*"),
|
_c: '*',
|
||||||
tb,
|
tb,
|
||||||
_d: String::from("¤"),
|
_d: '¤',
|
||||||
ix,
|
ix,
|
||||||
fd,
|
fd,
|
||||||
id,
|
id,
|
||||||
|
|
|
@ -1,17 +1,18 @@
|
||||||
use crate::err::Error;
|
use crate::err::Error;
|
||||||
use crate::key::bytes::{deserialize, serialize};
|
use crate::key::bytes::{deserialize, serialize};
|
||||||
use crate::key::BASE;
|
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
#[derive(Clone, Debug, Eq, PartialEq, PartialOrd, Serialize, Deserialize)]
|
#[derive(Clone, Debug, Eq, PartialEq, PartialOrd, Serialize, Deserialize)]
|
||||||
pub struct Sc {
|
pub struct Sc {
|
||||||
kv: String,
|
__: char,
|
||||||
_a: String,
|
_a: char,
|
||||||
ns: String,
|
pub ns: String,
|
||||||
_b: String,
|
_b: char,
|
||||||
db: String,
|
pub db: String,
|
||||||
_c: String,
|
_c: char,
|
||||||
sc: String,
|
_d: char,
|
||||||
|
_e: char,
|
||||||
|
pub sc: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<Sc> for Vec<u8> {
|
impl From<Sc> for Vec<u8> {
|
||||||
|
@ -33,12 +34,14 @@ pub fn new(ns: &str, db: &str, sc: &str) -> Sc {
|
||||||
impl Sc {
|
impl Sc {
|
||||||
pub fn new(ns: String, db: String, sc: String) -> Sc {
|
pub fn new(ns: String, db: String, sc: String) -> Sc {
|
||||||
Sc {
|
Sc {
|
||||||
kv: BASE.to_owned(),
|
__: '/',
|
||||||
_a: String::from("*"),
|
_a: '*',
|
||||||
ns,
|
ns,
|
||||||
_b: String::from("*"),
|
_b: '*',
|
||||||
db,
|
db,
|
||||||
_c: String::from("!sc"),
|
_c: '!',
|
||||||
|
_d: 's',
|
||||||
|
_e: 'c',
|
||||||
sc,
|
sc,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,19 +1,22 @@
|
||||||
use crate::err::Error;
|
use crate::err::Error;
|
||||||
use crate::key::bytes::{deserialize, serialize};
|
use crate::key::bytes::{deserialize, serialize};
|
||||||
use crate::key::BASE;
|
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
#[derive(Clone, Debug, Eq, PartialEq, PartialOrd, Serialize, Deserialize)]
|
#[derive(Clone, Debug, Eq, PartialEq, PartialOrd, Serialize, Deserialize)]
|
||||||
pub struct St {
|
pub struct St {
|
||||||
kv: String,
|
__: char,
|
||||||
_a: String,
|
_a: char,
|
||||||
ns: String,
|
pub ns: String,
|
||||||
_b: String,
|
_b: char,
|
||||||
db: String,
|
pub db: String,
|
||||||
_c: String,
|
_c: char,
|
||||||
sc: String,
|
_d: char,
|
||||||
_d: String,
|
_e: char,
|
||||||
tk: String,
|
pub sc: String,
|
||||||
|
_f: char,
|
||||||
|
_g: char,
|
||||||
|
_h: char,
|
||||||
|
pub tk: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<St> for Vec<u8> {
|
impl From<St> for Vec<u8> {
|
||||||
|
@ -35,14 +38,18 @@ pub fn new(ns: &str, db: &str, sc: &str, tk: &str) -> St {
|
||||||
impl St {
|
impl St {
|
||||||
pub fn new(ns: String, db: String, sc: String, tk: String) -> St {
|
pub fn new(ns: String, db: String, sc: String, tk: String) -> St {
|
||||||
St {
|
St {
|
||||||
kv: BASE.to_owned(),
|
__: '/',
|
||||||
_a: String::from("*"),
|
_a: '*',
|
||||||
ns,
|
ns,
|
||||||
_b: String::from("*"),
|
_b: '*',
|
||||||
db,
|
db,
|
||||||
_c: String::from("!st"),
|
_c: '!',
|
||||||
|
_d: 's',
|
||||||
|
_e: 't',
|
||||||
sc,
|
sc,
|
||||||
_d: String::from("!tk"),
|
_f: '!',
|
||||||
|
_g: 't',
|
||||||
|
_h: 'k',
|
||||||
tk,
|
tk,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,17 +1,16 @@
|
||||||
use crate::err::Error;
|
use crate::err::Error;
|
||||||
use crate::key::bytes::{deserialize, serialize};
|
use crate::key::bytes::{deserialize, serialize};
|
||||||
use crate::key::BASE;
|
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
#[derive(Clone, Debug, Eq, PartialEq, PartialOrd, Serialize, Deserialize)]
|
#[derive(Clone, Debug, Eq, PartialEq, PartialOrd, Serialize, Deserialize)]
|
||||||
pub struct Table {
|
pub struct Table {
|
||||||
kv: String,
|
__: char,
|
||||||
_a: String,
|
_a: char,
|
||||||
ns: String,
|
pub ns: String,
|
||||||
_b: String,
|
_b: char,
|
||||||
db: String,
|
pub db: String,
|
||||||
_c: String,
|
_c: char,
|
||||||
tb: String,
|
pub tb: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<Table> for Vec<u8> {
|
impl From<Table> for Vec<u8> {
|
||||||
|
@ -33,12 +32,12 @@ pub fn new(ns: &str, db: &str, tb: &str) -> Table {
|
||||||
impl Table {
|
impl Table {
|
||||||
pub fn new(ns: String, db: String, tb: String) -> Table {
|
pub fn new(ns: String, db: String, tb: String) -> Table {
|
||||||
Table {
|
Table {
|
||||||
kv: BASE.to_owned(),
|
__: '/',
|
||||||
_a: String::from("*"),
|
_a: '*',
|
||||||
ns,
|
ns,
|
||||||
_b: String::from("*"),
|
_b: '*',
|
||||||
db,
|
db,
|
||||||
_c: String::from("*"),
|
_c: '*',
|
||||||
tb,
|
tb,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,17 +1,18 @@
|
||||||
use crate::err::Error;
|
use crate::err::Error;
|
||||||
use crate::key::bytes::{deserialize, serialize};
|
use crate::key::bytes::{deserialize, serialize};
|
||||||
use crate::key::BASE;
|
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
#[derive(Clone, Debug, Eq, PartialEq, PartialOrd, Serialize, Deserialize)]
|
#[derive(Clone, Debug, Eq, PartialEq, PartialOrd, Serialize, Deserialize)]
|
||||||
pub struct Tb {
|
pub struct Tb {
|
||||||
kv: String,
|
__: char,
|
||||||
_a: String,
|
_a: char,
|
||||||
ns: String,
|
pub ns: String,
|
||||||
_b: String,
|
_b: char,
|
||||||
db: String,
|
pub db: String,
|
||||||
_c: String,
|
_c: char,
|
||||||
tb: String,
|
_d: char,
|
||||||
|
_e: char,
|
||||||
|
pub tb: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<Tb> for Vec<u8> {
|
impl From<Tb> for Vec<u8> {
|
||||||
|
@ -33,12 +34,14 @@ pub fn new(ns: &str, db: &str, tb: &str) -> Tb {
|
||||||
impl Tb {
|
impl Tb {
|
||||||
pub fn new(ns: String, db: String, tb: String) -> Tb {
|
pub fn new(ns: String, db: String, tb: String) -> Tb {
|
||||||
Tb {
|
Tb {
|
||||||
kv: BASE.to_owned(),
|
__: '/',
|
||||||
_a: String::from("*"),
|
_a: '*',
|
||||||
ns,
|
ns,
|
||||||
_b: String::from("*"),
|
_b: '*',
|
||||||
db,
|
db,
|
||||||
_c: String::from("!tb"),
|
_c: '!',
|
||||||
|
_d: 't',
|
||||||
|
_e: 'b',
|
||||||
tb,
|
tb,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,19 +1,18 @@
|
||||||
use crate::err::Error;
|
use crate::err::Error;
|
||||||
use crate::key::bytes::{deserialize, serialize};
|
use crate::key::bytes::{deserialize, serialize};
|
||||||
use crate::key::BASE;
|
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
#[derive(Clone, Debug, Eq, PartialEq, PartialOrd, Serialize, Deserialize)]
|
#[derive(Clone, Debug, Eq, PartialEq, PartialOrd, Serialize, Deserialize)]
|
||||||
pub struct Thing {
|
pub struct Thing {
|
||||||
kv: String,
|
__: char,
|
||||||
_a: String,
|
_a: char,
|
||||||
ns: String,
|
pub ns: String,
|
||||||
_b: String,
|
_b: char,
|
||||||
db: String,
|
pub db: String,
|
||||||
_c: String,
|
_c: char,
|
||||||
tb: String,
|
pub tb: String,
|
||||||
_d: String,
|
_d: char,
|
||||||
id: String,
|
pub id: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<Thing> for Vec<u8> {
|
impl From<Thing> for Vec<u8> {
|
||||||
|
@ -28,6 +27,12 @@ impl From<Vec<u8>> for Thing {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl From<&Vec<u8>> for Thing {
|
||||||
|
fn from(val: &Vec<u8>) -> Self {
|
||||||
|
Thing::decode(&val).unwrap()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
pub fn new(ns: &str, db: &str, tb: &str, id: &str) -> Thing {
|
pub fn new(ns: &str, db: &str, tb: &str, id: &str) -> Thing {
|
||||||
Thing::new(ns.to_string(), db.to_string(), tb.to_string(), id.to_string())
|
Thing::new(ns.to_string(), db.to_string(), tb.to_string(), id.to_string())
|
||||||
}
|
}
|
||||||
|
@ -35,14 +40,14 @@ pub fn new(ns: &str, db: &str, tb: &str, id: &str) -> Thing {
|
||||||
impl Thing {
|
impl Thing {
|
||||||
pub fn new(ns: String, db: String, tb: String, id: String) -> Thing {
|
pub fn new(ns: String, db: String, tb: String, id: String) -> Thing {
|
||||||
Thing {
|
Thing {
|
||||||
kv: BASE.to_owned(),
|
__: '/',
|
||||||
_a: String::from("*"),
|
_a: '*',
|
||||||
ns,
|
ns,
|
||||||
_b: String::from("*"),
|
_b: '*',
|
||||||
db,
|
db,
|
||||||
_c: String::from("*"),
|
_c: '*',
|
||||||
tb,
|
tb,
|
||||||
_d: String::from("*"),
|
_d: '*',
|
||||||
id,
|
id,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue