Favour rust binary characters instead of hex (#1978)
This commit is contained in:
parent
8780bbda9c
commit
df745bb3a5
27 changed files with 200 additions and 194 deletions
|
@ -20,27 +20,27 @@ pub fn new<'a>(ns: &'a str, db: &'a str, tb: &'a str) -> Az<'a> {
|
||||||
|
|
||||||
pub fn prefix(ns: &str, db: &str) -> Vec<u8> {
|
pub fn prefix(ns: &str, db: &str) -> Vec<u8> {
|
||||||
let mut k = super::database::new(ns, db).encode().unwrap();
|
let mut k = super::database::new(ns, db).encode().unwrap();
|
||||||
k.extend_from_slice(&[0x21, 0x61, 0x7a, 0x00]);
|
k.extend_from_slice(&[b'!', b'a', b'z', 0x00]);
|
||||||
k
|
k
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn suffix(ns: &str, db: &str) -> Vec<u8> {
|
pub fn suffix(ns: &str, db: &str) -> Vec<u8> {
|
||||||
let mut k = super::database::new(ns, db).encode().unwrap();
|
let mut k = super::database::new(ns, db).encode().unwrap();
|
||||||
k.extend_from_slice(&[0x21, 0x61, 0x7a, 0xff]);
|
k.extend_from_slice(&[b'!', b'a', b'z', 0xff]);
|
||||||
k
|
k
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> Az<'a> {
|
impl<'a> Az<'a> {
|
||||||
pub fn new(ns: &'a str, db: &'a str, az: &'a str) -> Self {
|
pub fn new(ns: &'a str, db: &'a str, az: &'a str) -> Self {
|
||||||
Self {
|
Self {
|
||||||
__: 0x2f, // /
|
__: b'/', // /
|
||||||
_a: 0x2a, // *
|
_a: b'*', // *
|
||||||
ns,
|
ns,
|
||||||
_b: 0x2a, // *
|
_b: b'*', // *
|
||||||
db,
|
db,
|
||||||
_c: 0x21, // !
|
_c: b'!', // !
|
||||||
_d: 0x61, // a
|
_d: b'a', // a
|
||||||
_e: 0x7a, // z
|
_e: b'z', // z
|
||||||
az,
|
az,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,10 +17,10 @@ pub fn new<'a>(ns: &'a str, db: &'a str) -> Database<'a> {
|
||||||
impl<'a> Database<'a> {
|
impl<'a> Database<'a> {
|
||||||
pub fn new(ns: &'a str, db: &'a str) -> Self {
|
pub fn new(ns: &'a str, db: &'a str) -> Self {
|
||||||
Self {
|
Self {
|
||||||
__: 0x2f, // /
|
__: b'/', // /
|
||||||
_a: 0x2a, // *
|
_a: b'*', // *
|
||||||
ns,
|
ns,
|
||||||
_b: 0x2a, // *
|
_b: b'*', // *
|
||||||
db,
|
db,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,25 +18,25 @@ pub fn new<'a>(ns: &'a str, db: &'a str) -> Db<'a> {
|
||||||
|
|
||||||
pub fn prefix(ns: &str) -> Vec<u8> {
|
pub fn prefix(ns: &str) -> Vec<u8> {
|
||||||
let mut k = super::namespace::new(ns).encode().unwrap();
|
let mut k = super::namespace::new(ns).encode().unwrap();
|
||||||
k.extend_from_slice(&[0x21, 0x64, 0x62, 0x00]);
|
k.extend_from_slice(&[b'!', b'd', b'b', 0x00]);
|
||||||
k
|
k
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn suffix(ns: &str) -> Vec<u8> {
|
pub fn suffix(ns: &str) -> Vec<u8> {
|
||||||
let mut k = super::namespace::new(ns).encode().unwrap();
|
let mut k = super::namespace::new(ns).encode().unwrap();
|
||||||
k.extend_from_slice(&[0x21, 0x64, 0x62, 0xff]);
|
k.extend_from_slice(&[b'!', b'd', b'b', 0xff]);
|
||||||
k
|
k
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> Db<'a> {
|
impl<'a> Db<'a> {
|
||||||
pub fn new(ns: &'a str, db: &'a str) -> Self {
|
pub fn new(ns: &'a str, db: &'a str) -> Self {
|
||||||
Self {
|
Self {
|
||||||
__: 0x2f, // /
|
__: b'/',
|
||||||
_a: 0x2a, // *
|
_a: b'*',
|
||||||
ns,
|
ns,
|
||||||
_b: 0x21, // !
|
_b: b'!',
|
||||||
_c: 0x64, // d
|
_c: b'd',
|
||||||
_d: 0x62, // b
|
_d: b'b',
|
||||||
db,
|
db,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,27 +20,27 @@ pub fn new<'a>(ns: &'a str, db: &'a str, dl: &'a str) -> Dl<'a> {
|
||||||
|
|
||||||
pub fn prefix(ns: &str, db: &str) -> Vec<u8> {
|
pub fn prefix(ns: &str, db: &str) -> Vec<u8> {
|
||||||
let mut k = super::database::new(ns, db).encode().unwrap();
|
let mut k = super::database::new(ns, db).encode().unwrap();
|
||||||
k.extend_from_slice(&[0x21, 0x64, 0x6c, 0x00]);
|
k.extend_from_slice(&[b'!', b'd', b'l', 0x00]);
|
||||||
k
|
k
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn suffix(ns: &str, db: &str) -> Vec<u8> {
|
pub fn suffix(ns: &str, db: &str) -> Vec<u8> {
|
||||||
let mut k = super::database::new(ns, db).encode().unwrap();
|
let mut k = super::database::new(ns, db).encode().unwrap();
|
||||||
k.extend_from_slice(&[0x21, 0x64, 0x6c, 0xff]);
|
k.extend_from_slice(&[b'!', b'd', b'l', 0xff]);
|
||||||
k
|
k
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> Dl<'a> {
|
impl<'a> Dl<'a> {
|
||||||
pub fn new(ns: &'a str, db: &'a str, dl: &'a str) -> Self {
|
pub fn new(ns: &'a str, db: &'a str, dl: &'a str) -> Self {
|
||||||
Self {
|
Self {
|
||||||
__: 0x2f, // /
|
__: b'/',
|
||||||
_a: 0x2a, // *
|
_a: b'*',
|
||||||
ns,
|
ns,
|
||||||
_b: 0x2a, // *
|
_b: b'*',
|
||||||
db,
|
db,
|
||||||
_c: 0x21, // !
|
_c: b'!',
|
||||||
_d: 0x64, // d
|
_d: b'd',
|
||||||
_e: 0x6c, // l
|
_e: b'l',
|
||||||
dl,
|
dl,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,27 +20,27 @@ pub fn new<'a>(ns: &'a str, db: &'a str, tb: &'a str) -> Dt<'a> {
|
||||||
|
|
||||||
pub fn prefix(ns: &str, db: &str) -> Vec<u8> {
|
pub fn prefix(ns: &str, db: &str) -> Vec<u8> {
|
||||||
let mut k = super::database::new(ns, db).encode().unwrap();
|
let mut k = super::database::new(ns, db).encode().unwrap();
|
||||||
k.extend_from_slice(&[0x21, 0x64, 0x74, 0x00]);
|
k.extend_from_slice(&[b'!', b'd', b't', 0x00]);
|
||||||
k
|
k
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn suffix(ns: &str, db: &str) -> Vec<u8> {
|
pub fn suffix(ns: &str, db: &str) -> Vec<u8> {
|
||||||
let mut k = super::database::new(ns, db).encode().unwrap();
|
let mut k = super::database::new(ns, db).encode().unwrap();
|
||||||
k.extend_from_slice(&[0x21, 0x64, 0x74, 0xff]);
|
k.extend_from_slice(&[b'!', b'd', b't', 0xff]);
|
||||||
k
|
k
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> Dt<'a> {
|
impl<'a> Dt<'a> {
|
||||||
pub fn new(ns: &'a str, db: &'a str, tk: &'a str) -> Self {
|
pub fn new(ns: &'a str, db: &'a str, tk: &'a str) -> Self {
|
||||||
Self {
|
Self {
|
||||||
__: 0x2f, // /
|
__: b'/',
|
||||||
_a: 0x2a, // *
|
_a: b'*',
|
||||||
ns,
|
ns,
|
||||||
_b: 0x2a, // *
|
_b: b'*',
|
||||||
db,
|
db,
|
||||||
_c: 0x21, // !
|
_c: b'!',
|
||||||
_d: 0x64, // d
|
_d: b'd',
|
||||||
_e: 0x74, // t
|
_e: b't',
|
||||||
tk,
|
tk,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,29 +22,29 @@ pub fn new<'a>(ns: &'a str, db: &'a str, tb: &'a str, ev: &'a str) -> Ev<'a> {
|
||||||
|
|
||||||
pub fn prefix(ns: &str, db: &str, tb: &str) -> Vec<u8> {
|
pub fn prefix(ns: &str, db: &str, tb: &str) -> Vec<u8> {
|
||||||
let mut k = super::table::new(ns, db, tb).encode().unwrap();
|
let mut k = super::table::new(ns, db, tb).encode().unwrap();
|
||||||
k.extend_from_slice(&[0x21, 0x65, 0x76, 0x00]);
|
k.extend_from_slice(&[b'!', b'e', b'v', 0x00]);
|
||||||
k
|
k
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn suffix(ns: &str, db: &str, tb: &str) -> Vec<u8> {
|
pub fn suffix(ns: &str, db: &str, tb: &str) -> Vec<u8> {
|
||||||
let mut k = super::table::new(ns, db, tb).encode().unwrap();
|
let mut k = super::table::new(ns, db, tb).encode().unwrap();
|
||||||
k.extend_from_slice(&[0x21, 0x65, 0x76, 0xff]);
|
k.extend_from_slice(&[b'!', b'e', b'v', 0xff]);
|
||||||
k
|
k
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> Ev<'a> {
|
impl<'a> Ev<'a> {
|
||||||
pub fn new(ns: &'a str, db: &'a str, tb: &'a str, ev: &'a str) -> Self {
|
pub fn new(ns: &'a str, db: &'a str, tb: &'a str, ev: &'a str) -> Self {
|
||||||
Self {
|
Self {
|
||||||
__: 0x2f, // /
|
__: b'/',
|
||||||
_a: 0x2a, // *
|
_a: b'*',
|
||||||
ns,
|
ns,
|
||||||
_b: 0x2a, // *
|
_b: b'*',
|
||||||
db,
|
db,
|
||||||
_c: 0x2a, // *
|
_c: b'*',
|
||||||
tb,
|
tb,
|
||||||
_d: 0x21, // !
|
_d: b'!',
|
||||||
_e: 0x65, // e
|
_e: b'e',
|
||||||
_f: 0x76, // v
|
_f: b'v',
|
||||||
ev,
|
ev,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,27 +20,27 @@ pub fn new<'a>(ns: &'a str, db: &'a str, fc: &'a str) -> Fc<'a> {
|
||||||
|
|
||||||
pub fn prefix(ns: &str, db: &str) -> Vec<u8> {
|
pub fn prefix(ns: &str, db: &str) -> Vec<u8> {
|
||||||
let mut k = super::database::new(ns, db).encode().unwrap();
|
let mut k = super::database::new(ns, db).encode().unwrap();
|
||||||
k.extend_from_slice(&[0x21, 0x66, 0x6e, 0x00]);
|
k.extend_from_slice(&[b'!', b'f', b'n', 0x00]);
|
||||||
k
|
k
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn suffix(ns: &str, db: &str) -> Vec<u8> {
|
pub fn suffix(ns: &str, db: &str) -> Vec<u8> {
|
||||||
let mut k = super::database::new(ns, db).encode().unwrap();
|
let mut k = super::database::new(ns, db).encode().unwrap();
|
||||||
k.extend_from_slice(&[0x21, 0x66, 0x6e, 0xff]);
|
k.extend_from_slice(&[b'!', b'f', b'n', 0xff]);
|
||||||
k
|
k
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> Fc<'a> {
|
impl<'a> Fc<'a> {
|
||||||
pub fn new(ns: &'a str, db: &'a str, fc: &'a str) -> Self {
|
pub fn new(ns: &'a str, db: &'a str, fc: &'a str) -> Self {
|
||||||
Self {
|
Self {
|
||||||
__: 0x2f, // /
|
__: b'/',
|
||||||
_a: 0x2a, // *
|
_a: b'*',
|
||||||
ns,
|
ns,
|
||||||
_b: 0x2a, // *
|
_b: b'*',
|
||||||
db,
|
db,
|
||||||
_c: 0x21, // !
|
_c: b'!',
|
||||||
_d: 0x66, // f
|
_d: b'f',
|
||||||
_e: 0x6e, // n
|
_e: b'n',
|
||||||
fc,
|
fc,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,29 +22,29 @@ pub fn new<'a>(ns: &'a str, db: &'a str, tb: &'a str, fd: &'a str) -> Fd<'a> {
|
||||||
|
|
||||||
pub fn prefix(ns: &str, db: &str, tb: &str) -> Vec<u8> {
|
pub fn prefix(ns: &str, db: &str, tb: &str) -> Vec<u8> {
|
||||||
let mut k = super::table::new(ns, db, tb).encode().unwrap();
|
let mut k = super::table::new(ns, db, tb).encode().unwrap();
|
||||||
k.extend_from_slice(&[0x21, 0x66, 0x64, 0x00]);
|
k.extend_from_slice(&[b'!', b'f', b'd', 0x00]);
|
||||||
k
|
k
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn suffix(ns: &str, db: &str, tb: &str) -> Vec<u8> {
|
pub fn suffix(ns: &str, db: &str, tb: &str) -> Vec<u8> {
|
||||||
let mut k = super::table::new(ns, db, tb).encode().unwrap();
|
let mut k = super::table::new(ns, db, tb).encode().unwrap();
|
||||||
k.extend_from_slice(&[0x21, 0x66, 0x64, 0xff]);
|
k.extend_from_slice(&[b'!', b'f', b'd', 0xff]);
|
||||||
k
|
k
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> Fd<'a> {
|
impl<'a> Fd<'a> {
|
||||||
pub fn new(ns: &'a str, db: &'a str, tb: &'a str, fd: &'a str) -> Self {
|
pub fn new(ns: &'a str, db: &'a str, tb: &'a str, fd: &'a str) -> Self {
|
||||||
Self {
|
Self {
|
||||||
__: 0x2f, // /
|
__: b'/',
|
||||||
_a: 0x2a, // *
|
_a: b'*',
|
||||||
ns,
|
ns,
|
||||||
_b: 0x2a, // *
|
_b: b'*',
|
||||||
db,
|
db,
|
||||||
_c: 0x2a, // *
|
_c: b'*',
|
||||||
tb,
|
tb,
|
||||||
_d: 0x21, // !
|
_d: b'!',
|
||||||
_e: 0x66, // f
|
_e: b'f',
|
||||||
_f: 0x64, // d
|
_f: b'd',
|
||||||
fd,
|
fd,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,29 +22,29 @@ pub fn new<'a>(ns: &'a str, db: &'a str, tb: &'a str, ft: &'a str) -> Ft<'a> {
|
||||||
|
|
||||||
pub fn prefix(ns: &str, db: &str, tb: &str) -> Vec<u8> {
|
pub fn prefix(ns: &str, db: &str, tb: &str) -> Vec<u8> {
|
||||||
let mut k = super::table::new(ns, db, tb).encode().unwrap();
|
let mut k = super::table::new(ns, db, tb).encode().unwrap();
|
||||||
k.extend_from_slice(&[0x21, 0x66, 0x74, 0x00]);
|
k.extend_from_slice(&[b'!', b'f', b't', 0x00]);
|
||||||
k
|
k
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn suffix(ns: &str, db: &str, tb: &str) -> Vec<u8> {
|
pub fn suffix(ns: &str, db: &str, tb: &str) -> Vec<u8> {
|
||||||
let mut k = super::table::new(ns, db, tb).encode().unwrap();
|
let mut k = super::table::new(ns, db, tb).encode().unwrap();
|
||||||
k.extend_from_slice(&[0x21, 0x66, 0x74, 0xff]);
|
k.extend_from_slice(&[b'!', b'f', b't', 0xff]);
|
||||||
k
|
k
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> Ft<'a> {
|
impl<'a> Ft<'a> {
|
||||||
pub fn new(ns: &'a str, db: &'a str, tb: &'a str, ft: &'a str) -> Self {
|
pub fn new(ns: &'a str, db: &'a str, tb: &'a str, ft: &'a str) -> Self {
|
||||||
Self {
|
Self {
|
||||||
__: 0x2f, // /
|
__: b'/',
|
||||||
_a: 0x2a, // *
|
_a: b'*',
|
||||||
ns,
|
ns,
|
||||||
_b: 0x2a, // *
|
_b: b'*',
|
||||||
db,
|
db,
|
||||||
_c: 0x2a, // *
|
_c: b'*',
|
||||||
tb,
|
tb,
|
||||||
_d: 0x21, // !
|
_d: b'!',
|
||||||
_e: 0x66, // f
|
_e: b'f',
|
||||||
_f: 0x74, // t
|
_f: b't',
|
||||||
ft,
|
ft,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,14 +20,14 @@ struct Prefix<'a> {
|
||||||
impl<'a> Prefix<'a> {
|
impl<'a> Prefix<'a> {
|
||||||
fn new(ns: &'a str, db: &'a str, tb: &'a str, id: &Id) -> Self {
|
fn new(ns: &'a str, db: &'a str, tb: &'a str, id: &Id) -> Self {
|
||||||
Self {
|
Self {
|
||||||
__: 0x2f, // /
|
__: b'/',
|
||||||
_a: 0x2a, // *
|
_a: b'*',
|
||||||
ns,
|
ns,
|
||||||
_b: 0x2a, // *
|
_b: b'*',
|
||||||
db,
|
db,
|
||||||
_c: 0x2a, // *
|
_c: b'*',
|
||||||
tb,
|
tb,
|
||||||
_d: 0x7e, // ~
|
_d: b'~',
|
||||||
id: id.to_owned(),
|
id: id.to_owned(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -50,14 +50,14 @@ struct PrefixEg<'a> {
|
||||||
impl<'a> PrefixEg<'a> {
|
impl<'a> PrefixEg<'a> {
|
||||||
fn new(ns: &'a str, db: &'a str, tb: &'a str, id: &Id, eg: &Dir) -> Self {
|
fn new(ns: &'a str, db: &'a str, tb: &'a str, id: &Id, eg: &Dir) -> Self {
|
||||||
Self {
|
Self {
|
||||||
__: 0x2f, // /
|
__: b'/',
|
||||||
_a: 0x2a, // *
|
_a: b'*',
|
||||||
ns,
|
ns,
|
||||||
_b: 0x2a, // *
|
_b: b'*',
|
||||||
db,
|
db,
|
||||||
_c: 0x2a, // *
|
_c: b'*',
|
||||||
tb,
|
tb,
|
||||||
_d: 0x7e, // ~
|
_d: b'~',
|
||||||
id: id.to_owned(),
|
id: id.to_owned(),
|
||||||
eg: eg.to_owned(),
|
eg: eg.to_owned(),
|
||||||
}
|
}
|
||||||
|
@ -82,14 +82,14 @@ struct PrefixFt<'a> {
|
||||||
impl<'a> PrefixFt<'a> {
|
impl<'a> PrefixFt<'a> {
|
||||||
fn new(ns: &'a str, db: &'a str, tb: &'a str, id: &Id, eg: &Dir, ft: &'a str) -> Self {
|
fn new(ns: &'a str, db: &'a str, tb: &'a str, id: &Id, eg: &Dir, ft: &'a str) -> Self {
|
||||||
Self {
|
Self {
|
||||||
__: 0x2f, // /
|
__: b'/',
|
||||||
_a: 0x2a, // *
|
_a: b'*',
|
||||||
ns,
|
ns,
|
||||||
_b: 0x2a, // *
|
_b: b'*',
|
||||||
db,
|
db,
|
||||||
_c: 0x2a, // *
|
_c: b'*',
|
||||||
tb,
|
tb,
|
||||||
_d: 0x7e, // ~
|
_d: b'~',
|
||||||
id: id.to_owned(),
|
id: id.to_owned(),
|
||||||
eg: eg.to_owned(),
|
eg: eg.to_owned(),
|
||||||
ft,
|
ft,
|
||||||
|
@ -163,14 +163,14 @@ pub fn ftsuffix(ns: &str, db: &str, tb: &str, id: &Id, eg: &Dir, ft: &str) -> Ve
|
||||||
impl<'a> Graph<'a> {
|
impl<'a> Graph<'a> {
|
||||||
pub fn new(ns: &'a str, db: &'a str, tb: &'a str, id: Id, eg: Dir, fk: &'a Thing) -> Self {
|
pub fn new(ns: &'a str, db: &'a str, tb: &'a str, id: Id, eg: Dir, fk: &'a Thing) -> Self {
|
||||||
Self {
|
Self {
|
||||||
__: 0x2f, // /
|
__: b'/',
|
||||||
_a: 0x2a, // *
|
_a: b'*',
|
||||||
ns,
|
ns,
|
||||||
_b: 0x2a, // *
|
_b: b'*',
|
||||||
db,
|
db,
|
||||||
_c: 0x2a, // *
|
_c: b'*',
|
||||||
tb,
|
tb,
|
||||||
_d: 0x7e, // ~
|
_d: b'~',
|
||||||
id,
|
id,
|
||||||
eg,
|
eg,
|
||||||
ft: &fk.tb,
|
ft: &fk.tb,
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
use crate::key::CHAR_INDEX;
|
||||||
use crate::sql::array::Array;
|
use crate::sql::array::Array;
|
||||||
use crate::sql::id::Id;
|
use crate::sql::id::Id;
|
||||||
use derive::Key;
|
use derive::Key;
|
||||||
|
@ -19,14 +20,14 @@ struct Prefix<'a> {
|
||||||
impl<'a> Prefix<'a> {
|
impl<'a> Prefix<'a> {
|
||||||
fn new(ns: &'a str, db: &'a str, tb: &'a str, ix: &'a str) -> Self {
|
fn new(ns: &'a str, db: &'a str, tb: &'a str, ix: &'a str) -> Self {
|
||||||
Self {
|
Self {
|
||||||
__: 0x2f, // /
|
__: b'/',
|
||||||
_a: 0x2a, // *
|
_a: b'*',
|
||||||
ns,
|
ns,
|
||||||
_b: 0x2a, // *
|
_b: b'*',
|
||||||
db,
|
db,
|
||||||
_c: 0x2a, // *
|
_c: b'*',
|
||||||
tb,
|
tb,
|
||||||
_d: 0xa4, // ¤
|
_d: CHAR_INDEX,
|
||||||
ix,
|
ix,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -80,14 +81,14 @@ impl<'a> Index<'a> {
|
||||||
id: Option<Id>,
|
id: Option<Id>,
|
||||||
) -> Self {
|
) -> Self {
|
||||||
Self {
|
Self {
|
||||||
__: 0x2f, // /
|
__: b'/',
|
||||||
_a: 0x2a, // *
|
_a: b'*',
|
||||||
ns,
|
ns,
|
||||||
_b: 0x2a, // *
|
_b: b'*',
|
||||||
db,
|
db,
|
||||||
_c: 0x2a, // *
|
_c: b'*',
|
||||||
tb,
|
tb,
|
||||||
_d: 0xa4, // ¤
|
_d: CHAR_INDEX,
|
||||||
ix,
|
ix,
|
||||||
fd,
|
fd,
|
||||||
id,
|
id,
|
||||||
|
|
|
@ -22,29 +22,29 @@ pub fn new<'a>(ns: &'a str, db: &'a str, tb: &'a str, ix: &'a str) -> Ix<'a> {
|
||||||
|
|
||||||
pub fn prefix(ns: &str, db: &str, tb: &str) -> Vec<u8> {
|
pub fn prefix(ns: &str, db: &str, tb: &str) -> Vec<u8> {
|
||||||
let mut k = super::table::new(ns, db, tb).encode().unwrap();
|
let mut k = super::table::new(ns, db, tb).encode().unwrap();
|
||||||
k.extend_from_slice(&[0x21, 0x69, 0x78, 0x00]);
|
k.extend_from_slice(&[b'!', b'i', b'x', 0x00]);
|
||||||
k
|
k
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn suffix(ns: &str, db: &str, tb: &str) -> Vec<u8> {
|
pub fn suffix(ns: &str, db: &str, tb: &str) -> Vec<u8> {
|
||||||
let mut k = super::table::new(ns, db, tb).encode().unwrap();
|
let mut k = super::table::new(ns, db, tb).encode().unwrap();
|
||||||
k.extend_from_slice(&[0x21, 0x69, 0x78, 0xff]);
|
k.extend_from_slice(&[b'!', b'i', b'x', 0xff]);
|
||||||
k
|
k
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> Ix<'a> {
|
impl<'a> Ix<'a> {
|
||||||
pub fn new(ns: &'a str, db: &'a str, tb: &'a str, ix: &'a str) -> Self {
|
pub fn new(ns: &'a str, db: &'a str, tb: &'a str, ix: &'a str) -> Self {
|
||||||
Self {
|
Self {
|
||||||
__: 0x2f, // /
|
__: b'/',
|
||||||
_a: 0x2a, // *
|
_a: b'*',
|
||||||
ns,
|
ns,
|
||||||
_b: 0x2a, // *
|
_b: b'*',
|
||||||
db,
|
db,
|
||||||
_c: 0x2a, // *
|
_c: b'*',
|
||||||
tb,
|
tb,
|
||||||
_d: 0x21, // !
|
_d: b'!',
|
||||||
_e: 0x69, // i
|
_e: b'i',
|
||||||
_f: 0x78, // x
|
_f: b'x',
|
||||||
ix,
|
ix,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,7 +19,7 @@ impl Default for Kv {
|
||||||
impl Kv {
|
impl Kv {
|
||||||
pub fn new() -> Kv {
|
pub fn new() -> Kv {
|
||||||
Kv {
|
Kv {
|
||||||
__: 0x2f, // /
|
__: b'/',
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,14 +22,14 @@ pub fn new<'a>(ns: &'a str, db: &'a str, lq: &Uuid) -> Lq<'a> {
|
||||||
impl<'a> Lq<'a> {
|
impl<'a> Lq<'a> {
|
||||||
pub fn new(ns: &'a str, db: &'a str, lq: Uuid) -> Self {
|
pub fn new(ns: &'a str, db: &'a str, lq: Uuid) -> Self {
|
||||||
Self {
|
Self {
|
||||||
__: 0x2f, // /
|
__: b'/',
|
||||||
_a: 0x2a, // *
|
_a: b'*',
|
||||||
ns,
|
ns,
|
||||||
_b: 0x2a, // *
|
_b: b'*',
|
||||||
db,
|
db,
|
||||||
_c: 0x21, // !
|
_c: b'!',
|
||||||
_d: 0x6c, // l
|
_d: b'l',
|
||||||
_e: 0x71, // v
|
_e: b'v',
|
||||||
lq,
|
lq,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,29 +23,29 @@ pub fn new<'a>(ns: &'a str, db: &'a str, tb: &'a str, lv: &Uuid) -> Lv<'a> {
|
||||||
|
|
||||||
pub fn prefix(ns: &str, db: &str, tb: &str) -> Vec<u8> {
|
pub fn prefix(ns: &str, db: &str, tb: &str) -> Vec<u8> {
|
||||||
let mut k = super::table::new(ns, db, tb).encode().unwrap();
|
let mut k = super::table::new(ns, db, tb).encode().unwrap();
|
||||||
k.extend_from_slice(&[0x21, 0x6c, 0x76, 0x00]);
|
k.extend_from_slice(&[b'!', b'l', b'v', 0x00]);
|
||||||
k
|
k
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn suffix(ns: &str, db: &str, tb: &str) -> Vec<u8> {
|
pub fn suffix(ns: &str, db: &str, tb: &str) -> Vec<u8> {
|
||||||
let mut k = super::table::new(ns, db, tb).encode().unwrap();
|
let mut k = super::table::new(ns, db, tb).encode().unwrap();
|
||||||
k.extend_from_slice(&[0x21, 0x6c, 0x76, 0xff]);
|
k.extend_from_slice(&[b'!', b'l', b'v', 0xff]);
|
||||||
k
|
k
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> Lv<'a> {
|
impl<'a> Lv<'a> {
|
||||||
pub fn new(ns: &'a str, db: &'a str, tb: &'a str, lv: Uuid) -> Self {
|
pub fn new(ns: &'a str, db: &'a str, tb: &'a str, lv: Uuid) -> Self {
|
||||||
Self {
|
Self {
|
||||||
__: 0x2f, // /
|
__: b'/',
|
||||||
_a: 0x2a, // *
|
_a: b'*',
|
||||||
ns,
|
ns,
|
||||||
_b: 0x2a, // *
|
_b: b'*',
|
||||||
db,
|
db,
|
||||||
_c: 0x2a, // *
|
_c: b'*',
|
||||||
tb,
|
tb,
|
||||||
_d: 0x21, // !
|
_d: b'!',
|
||||||
_e: 0x6c, // l
|
_e: b'l',
|
||||||
_f: 0x76, // v
|
_f: b'v',
|
||||||
lv,
|
lv,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -58,3 +58,6 @@ pub mod st; // Stores a DEFINE TOKEN ON SCOPE config definition
|
||||||
pub mod table; // Stores the key prefix for all keys under a table
|
pub mod table; // Stores the key prefix for all keys under a table
|
||||||
pub mod tb; // Stores a DEFINE TABLE config definition
|
pub mod tb; // Stores a DEFINE TABLE config definition
|
||||||
pub mod thing; // Stores a record id
|
pub mod thing; // Stores a record id
|
||||||
|
|
||||||
|
const CHAR_PATH: u8 = 0xb1; // ±
|
||||||
|
const CHAR_INDEX: u8 = 0xa4; // ¤
|
||||||
|
|
|
@ -15,8 +15,8 @@ pub fn new(ns: &str) -> Namespace<'_> {
|
||||||
impl<'a> Namespace<'a> {
|
impl<'a> Namespace<'a> {
|
||||||
pub fn new(ns: &'a str) -> Self {
|
pub fn new(ns: &'a str) -> Self {
|
||||||
Self {
|
Self {
|
||||||
__: 0x2f, // /
|
__: b'/',
|
||||||
_a: 0x2a, // *
|
_a: b'*',
|
||||||
ns,
|
ns,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,25 +18,25 @@ pub fn new<'a>(ns: &'a str, us: &'a str) -> Nl<'a> {
|
||||||
|
|
||||||
pub fn prefix(ns: &str) -> Vec<u8> {
|
pub fn prefix(ns: &str) -> Vec<u8> {
|
||||||
let mut k = super::namespace::new(ns).encode().unwrap();
|
let mut k = super::namespace::new(ns).encode().unwrap();
|
||||||
k.extend_from_slice(&[0x21, 0x6e, 0x6c, 0x00]);
|
k.extend_from_slice(&[b'!', b'n', b'l', 0x00]);
|
||||||
k
|
k
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn suffix(ns: &str) -> Vec<u8> {
|
pub fn suffix(ns: &str) -> Vec<u8> {
|
||||||
let mut k = super::namespace::new(ns).encode().unwrap();
|
let mut k = super::namespace::new(ns).encode().unwrap();
|
||||||
k.extend_from_slice(&[0x21, 0x6e, 0x6c, 0xff]);
|
k.extend_from_slice(&[b'!', b'n', b'l', 0xff]);
|
||||||
k
|
k
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> Nl<'a> {
|
impl<'a> Nl<'a> {
|
||||||
pub fn new(ns: &'a str, us: &'a str) -> Self {
|
pub fn new(ns: &'a str, us: &'a str) -> Self {
|
||||||
Self {
|
Self {
|
||||||
__: 0x2f, // /
|
__: b'/',
|
||||||
_a: 0x2a, // *
|
_a: b'*',
|
||||||
ns,
|
ns,
|
||||||
_b: 0x21, // !
|
_b: b'!',
|
||||||
_c: 0x6e, // n
|
_c: b'n',
|
||||||
_d: 0x6c, // l
|
_d: b'l',
|
||||||
us,
|
us,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,23 +16,23 @@ pub fn new(ns: &str) -> Ns<'_> {
|
||||||
|
|
||||||
pub fn prefix() -> Vec<u8> {
|
pub fn prefix() -> Vec<u8> {
|
||||||
let mut k = super::kv::new().encode().unwrap();
|
let mut k = super::kv::new().encode().unwrap();
|
||||||
k.extend_from_slice(&[0x21, 0x6e, 0x73, 0x00]);
|
k.extend_from_slice(&[b'!', b'n', b's', 0x00]);
|
||||||
k
|
k
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn suffix() -> Vec<u8> {
|
pub fn suffix() -> Vec<u8> {
|
||||||
let mut k = super::kv::new().encode().unwrap();
|
let mut k = super::kv::new().encode().unwrap();
|
||||||
k.extend_from_slice(&[0x21, 0x6e, 0x73, 0xff]);
|
k.extend_from_slice(&[b'!', b'n', b's', 0xff]);
|
||||||
k
|
k
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> Ns<'a> {
|
impl<'a> Ns<'a> {
|
||||||
pub fn new(ns: &'a str) -> Self {
|
pub fn new(ns: &'a str) -> Self {
|
||||||
Self {
|
Self {
|
||||||
__: 0x2f, // /
|
__: b'/',
|
||||||
_a: 0x21, // !
|
_a: b'!',
|
||||||
_b: 0x6e, // n
|
_b: b'n',
|
||||||
_c: 0x73, // s
|
_c: b's',
|
||||||
ns,
|
ns,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,25 +18,25 @@ pub fn new<'a>(ns: &'a str, tk: &'a str) -> Nt<'a> {
|
||||||
|
|
||||||
pub fn prefix(ns: &str) -> Vec<u8> {
|
pub fn prefix(ns: &str) -> Vec<u8> {
|
||||||
let mut k = super::namespace::new(ns).encode().unwrap();
|
let mut k = super::namespace::new(ns).encode().unwrap();
|
||||||
k.extend_from_slice(&[0x21, 0x6e, 0x74, 0x00]);
|
k.extend_from_slice(&[b'!', b'n', b't', 0x00]);
|
||||||
k
|
k
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn suffix(ns: &str) -> Vec<u8> {
|
pub fn suffix(ns: &str) -> Vec<u8> {
|
||||||
let mut k = super::namespace::new(ns).encode().unwrap();
|
let mut k = super::namespace::new(ns).encode().unwrap();
|
||||||
k.extend_from_slice(&[0x21, 0x6e, 0x74, 0xff]);
|
k.extend_from_slice(&[b'!', b'n', b't', 0xff]);
|
||||||
k
|
k
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> Nt<'a> {
|
impl<'a> Nt<'a> {
|
||||||
pub fn new(ns: &'a str, tk: &'a str) -> Self {
|
pub fn new(ns: &'a str, tk: &'a str) -> Self {
|
||||||
Self {
|
Self {
|
||||||
__: 0x2f, // /
|
__: b'/',
|
||||||
_a: 0x2a, // *
|
_a: b'*',
|
||||||
ns,
|
ns,
|
||||||
_b: 0x21, // !
|
_b: b'!',
|
||||||
_c: 0x6e, // n
|
_c: b'n',
|
||||||
_d: 0x74, // t
|
_d: b't',
|
||||||
tk,
|
tk,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,27 +20,27 @@ pub fn new<'a>(ns: &'a str, db: &'a str, pa: &'a str) -> Pa<'a> {
|
||||||
|
|
||||||
pub fn prefix(ns: &str, db: &str) -> Vec<u8> {
|
pub fn prefix(ns: &str, db: &str) -> Vec<u8> {
|
||||||
let mut k = super::database::new(ns, db).encode().unwrap();
|
let mut k = super::database::new(ns, db).encode().unwrap();
|
||||||
k.extend_from_slice(&[0x21, 0x70, 0x61, 0x00]);
|
k.extend_from_slice(&[b'!', b'p', b'a', 0x00]);
|
||||||
k
|
k
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn suffix(ns: &str, db: &str) -> Vec<u8> {
|
pub fn suffix(ns: &str, db: &str) -> Vec<u8> {
|
||||||
let mut k = super::database::new(ns, db).encode().unwrap();
|
let mut k = super::database::new(ns, db).encode().unwrap();
|
||||||
k.extend_from_slice(&[0x21, 0x70, 0x61, 0xff]);
|
k.extend_from_slice(&[b'!', b'p', b'a', 0xff]);
|
||||||
k
|
k
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> Pa<'a> {
|
impl<'a> Pa<'a> {
|
||||||
pub fn new(ns: &'a str, db: &'a str, pa: &'a str) -> Self {
|
pub fn new(ns: &'a str, db: &'a str, pa: &'a str) -> Self {
|
||||||
Self {
|
Self {
|
||||||
__: 0x2f, // /
|
__: b'/',
|
||||||
_a: 0x2a, // *
|
_a: b'*',
|
||||||
ns,
|
ns,
|
||||||
_b: 0x2a, // *
|
_b: b'*',
|
||||||
db,
|
db,
|
||||||
_c: 0x21, // !
|
_c: b'!',
|
||||||
_d: 0x70, // p
|
_d: b'p',
|
||||||
_e: 0x61, // a
|
_e: b'a',
|
||||||
pa,
|
pa,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,27 +20,27 @@ pub fn new<'a>(ns: &'a str, db: &'a str, sc: &'a str) -> Sc<'a> {
|
||||||
|
|
||||||
pub fn prefix(ns: &str, db: &str) -> Vec<u8> {
|
pub fn prefix(ns: &str, db: &str) -> Vec<u8> {
|
||||||
let mut k = super::database::new(ns, db).encode().unwrap();
|
let mut k = super::database::new(ns, db).encode().unwrap();
|
||||||
k.extend_from_slice(&[0x21, 0x73, 0x63, 0x00]);
|
k.extend_from_slice(&[b'!', b's', b'c', 0x00]);
|
||||||
k
|
k
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn suffix(ns: &str, db: &str) -> Vec<u8> {
|
pub fn suffix(ns: &str, db: &str) -> Vec<u8> {
|
||||||
let mut k = super::database::new(ns, db).encode().unwrap();
|
let mut k = super::database::new(ns, db).encode().unwrap();
|
||||||
k.extend_from_slice(&[0x21, 0x73, 0x63, 0xff]);
|
k.extend_from_slice(&[b'!', b's', b'c', 0xff]);
|
||||||
k
|
k
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> Sc<'a> {
|
impl<'a> Sc<'a> {
|
||||||
pub fn new(ns: &'a str, db: &'a str, sc: &'a str) -> Self {
|
pub fn new(ns: &'a str, db: &'a str, sc: &'a str) -> Self {
|
||||||
Self {
|
Self {
|
||||||
__: 0x2f, // /
|
__: b'/',
|
||||||
_a: 0x2a, // *
|
_a: b'*',
|
||||||
ns,
|
ns,
|
||||||
_b: 0x2a, // *
|
_b: b'*',
|
||||||
db,
|
db,
|
||||||
_c: 0x21, // !
|
_c: b'!',
|
||||||
_d: 0x73, // s
|
_d: b's',
|
||||||
_e: 0x63, // c
|
_e: b'c',
|
||||||
sc,
|
sc,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
use crate::key::CHAR_PATH;
|
||||||
use derive::Key;
|
use derive::Key;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
|
@ -19,12 +20,12 @@ pub fn new<'a>(ns: &'a str, db: &'a str, sc: &'a str) -> Scope<'a> {
|
||||||
impl<'a> Scope<'a> {
|
impl<'a> Scope<'a> {
|
||||||
pub fn new(ns: &'a str, db: &'a str, sc: &'a str) -> Self {
|
pub fn new(ns: &'a str, db: &'a str, sc: &'a str) -> Self {
|
||||||
Self {
|
Self {
|
||||||
__: 0x2f, // /
|
__: b'/',
|
||||||
_a: 0x2a, // *
|
_a: b'*',
|
||||||
ns,
|
ns,
|
||||||
_b: 0x2a, // *
|
_b: b'*',
|
||||||
db,
|
db,
|
||||||
_c: 0xb1, // ±
|
_c: CHAR_PATH,
|
||||||
sc,
|
sc,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
use crate::key::CHAR_PATH;
|
||||||
use derive::Key;
|
use derive::Key;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
|
@ -22,29 +23,29 @@ pub fn new<'a>(ns: &'a str, db: &'a str, sc: &'a str, tk: &'a str) -> St<'a> {
|
||||||
|
|
||||||
pub fn prefix(ns: &str, db: &str, sc: &str) -> Vec<u8> {
|
pub fn prefix(ns: &str, db: &str, sc: &str) -> Vec<u8> {
|
||||||
let mut k = super::scope::new(ns, db, sc).encode().unwrap();
|
let mut k = super::scope::new(ns, db, sc).encode().unwrap();
|
||||||
k.extend_from_slice(&[0x21, 0x73, 0x74, 0x00]);
|
k.extend_from_slice(&[b'!', b's', b't', 0x00]);
|
||||||
k
|
k
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn suffix(ns: &str, db: &str, sc: &str) -> Vec<u8> {
|
pub fn suffix(ns: &str, db: &str, sc: &str) -> Vec<u8> {
|
||||||
let mut k = super::scope::new(ns, db, sc).encode().unwrap();
|
let mut k = super::scope::new(ns, db, sc).encode().unwrap();
|
||||||
k.extend_from_slice(&[0x21, 0x73, 0x74, 0xff]);
|
k.extend_from_slice(&[b'!', b's', b't', 0xff]);
|
||||||
k
|
k
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> St<'a> {
|
impl<'a> St<'a> {
|
||||||
pub fn new(ns: &'a str, db: &'a str, sc: &'a str, tk: &'a str) -> Self {
|
pub fn new(ns: &'a str, db: &'a str, sc: &'a str, tk: &'a str) -> Self {
|
||||||
Self {
|
Self {
|
||||||
__: 0x2f, // /
|
__: b'/',
|
||||||
_a: 0x2a, // *
|
_a: b'*',
|
||||||
ns,
|
ns,
|
||||||
_b: 0x2a, // *
|
_b: b'*',
|
||||||
db,
|
db,
|
||||||
_c: 0xb1, // ±
|
_c: CHAR_PATH,
|
||||||
sc,
|
sc,
|
||||||
_d: 0x21, // !
|
_d: b'!',
|
||||||
_e: 0x73, // s
|
_e: b's',
|
||||||
_f: 0x74, // t
|
_f: b't',
|
||||||
tk,
|
tk,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,12 +19,12 @@ pub fn new<'a>(ns: &'a str, db: &'a str, tb: &'a str) -> Table<'a> {
|
||||||
impl<'a> Table<'a> {
|
impl<'a> Table<'a> {
|
||||||
pub fn new(ns: &'a str, db: &'a str, tb: &'a str) -> Self {
|
pub fn new(ns: &'a str, db: &'a str, tb: &'a str) -> Self {
|
||||||
Self {
|
Self {
|
||||||
__: 0x2f, // /
|
__: b'/',
|
||||||
_a: 0x2a, // *
|
_a: b'*',
|
||||||
ns,
|
ns,
|
||||||
_b: 0x2a, // *
|
_b: b'*',
|
||||||
db,
|
db,
|
||||||
_c: 0x2a, // *
|
_c: b'*',
|
||||||
tb,
|
tb,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,27 +20,27 @@ pub fn new<'a>(ns: &'a str, db: &'a str, tb: &'a str) -> Tb<'a> {
|
||||||
|
|
||||||
pub fn prefix(ns: &str, db: &str) -> Vec<u8> {
|
pub fn prefix(ns: &str, db: &str) -> Vec<u8> {
|
||||||
let mut k = super::database::new(ns, db).encode().unwrap();
|
let mut k = super::database::new(ns, db).encode().unwrap();
|
||||||
k.extend_from_slice(&[0x21, 0x74, 0x62, 0x00]);
|
k.extend_from_slice(&[b'!', b't', b'b', 0x00]);
|
||||||
k
|
k
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn suffix(ns: &str, db: &str) -> Vec<u8> {
|
pub fn suffix(ns: &str, db: &str) -> Vec<u8> {
|
||||||
let mut k = super::database::new(ns, db).encode().unwrap();
|
let mut k = super::database::new(ns, db).encode().unwrap();
|
||||||
k.extend_from_slice(&[0x21, 0x74, 0x62, 0xff]);
|
k.extend_from_slice(&[b'!', b't', b'b', 0xff]);
|
||||||
k
|
k
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> Tb<'a> {
|
impl<'a> Tb<'a> {
|
||||||
pub fn new(ns: &'a str, db: &'a str, tb: &'a str) -> Self {
|
pub fn new(ns: &'a str, db: &'a str, tb: &'a str) -> Self {
|
||||||
Self {
|
Self {
|
||||||
__: 0x2f, // /
|
__: b'/',
|
||||||
_a: 0x2a, // *
|
_a: b'*',
|
||||||
ns,
|
ns,
|
||||||
_b: 0x2a, // *
|
_b: b'*',
|
||||||
db,
|
db,
|
||||||
_c: 0x21, // !
|
_c: b'!',
|
||||||
_d: 0x74, // t
|
_d: b't',
|
||||||
_e: 0x62, // b
|
_e: b'b',
|
||||||
tb,
|
tb,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,27 +21,27 @@ pub fn new<'a>(ns: &'a str, db: &'a str, tb: &'a str, id: &Id) -> Thing<'a> {
|
||||||
|
|
||||||
pub fn prefix(ns: &str, db: &str, tb: &str) -> Vec<u8> {
|
pub fn prefix(ns: &str, db: &str, tb: &str) -> Vec<u8> {
|
||||||
let mut k = super::table::new(ns, db, tb).encode().unwrap();
|
let mut k = super::table::new(ns, db, tb).encode().unwrap();
|
||||||
k.extend_from_slice(&[0x2a, 0x00]);
|
k.extend_from_slice(&[b'*', 0x00]);
|
||||||
k
|
k
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn suffix(ns: &str, db: &str, tb: &str) -> Vec<u8> {
|
pub fn suffix(ns: &str, db: &str, tb: &str) -> Vec<u8> {
|
||||||
let mut k = super::table::new(ns, db, tb).encode().unwrap();
|
let mut k = super::table::new(ns, db, tb).encode().unwrap();
|
||||||
k.extend_from_slice(&[0x2a, 0xff]);
|
k.extend_from_slice(&[b'*', 0xff]);
|
||||||
k
|
k
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> Thing<'a> {
|
impl<'a> Thing<'a> {
|
||||||
pub fn new(ns: &'a str, db: &'a str, tb: &'a str, id: Id) -> Self {
|
pub fn new(ns: &'a str, db: &'a str, tb: &'a str, id: Id) -> Self {
|
||||||
Self {
|
Self {
|
||||||
__: 0x2f, // /
|
__: b'/',
|
||||||
_a: 0x2a, // *
|
_a: b'*',
|
||||||
ns,
|
ns,
|
||||||
_b: 0x2a, // *
|
_b: b'*',
|
||||||
db,
|
db,
|
||||||
_c: 0x2a, // *
|
_c: b'*',
|
||||||
tb,
|
tb,
|
||||||
_d: 0x2a, // *
|
_d: b'*',
|
||||||
id,
|
id,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue