[import] Support SurrealCS on the import command (#4706)
This commit is contained in:
parent
d2b2622a8f
commit
bb1884d56b
7 changed files with 90 additions and 56 deletions
|
@ -51,7 +51,7 @@ async fn migrate_ns_tokens(tx: Arc<Transaction>, ns: &str) -> Result<(), Error>
|
|||
|
||||
// We suffix the last id with a null byte, to prevent scanning it twice (which would result in an infinite loop)
|
||||
beg.clone_from(keys.last().unwrap());
|
||||
beg.extend_from_slice(&[b'\0']);
|
||||
beg.extend_from_slice(b"\0");
|
||||
|
||||
// Assign to queue
|
||||
queue.append(&mut keys);
|
||||
|
@ -97,7 +97,7 @@ async fn migrate_db_tokens(tx: Arc<Transaction>, ns: &str, db: &str) -> Result<(
|
|||
|
||||
// We suffix the last id with a null byte, to prevent scanning it twice (which would result in an infinite loop)
|
||||
beg.clone_from(keys.last().unwrap());
|
||||
beg.extend_from_slice(&[b'\0']);
|
||||
beg.extend_from_slice(b"\0");
|
||||
|
||||
// Assign to queue
|
||||
queue.append(&mut keys);
|
||||
|
@ -147,7 +147,7 @@ async fn collect_db_scope_keys(
|
|||
|
||||
// We suffix the last id with a null byte, to prevent scanning it twice (which would result in an infinite loop)
|
||||
beg.clone_from(keys.last().unwrap());
|
||||
beg.extend_from_slice(&[b'\0']);
|
||||
beg.extend_from_slice(b"\0");
|
||||
|
||||
// Assign to queue
|
||||
queue.append(&mut keys);
|
||||
|
@ -212,7 +212,7 @@ async fn migrate_sc_tokens(
|
|||
|
||||
// We suffix the last id with a null byte, to prevent scanning it twice (which would result in an infinite loop)
|
||||
beg.clone_from(keys.last().unwrap());
|
||||
beg.extend_from_slice(&[b'\0']);
|
||||
beg.extend_from_slice(b"\0");
|
||||
|
||||
// Assign to queue
|
||||
queue.append(&mut keys);
|
||||
|
|
|
@ -111,13 +111,20 @@ impl Method {
|
|||
matches!(
|
||||
self,
|
||||
Method::Ping
|
||||
| Method::Info | Method::Select
|
||||
| Method::Insert | Method::Create
|
||||
| Method::Update | Method::Upsert
|
||||
| Method::Merge | Method::Patch
|
||||
| Method::Delete | Method::Version
|
||||
| Method::Query | Method::Relate
|
||||
| Method::Run | Method::GraphQL
|
||||
| Method::Info
|
||||
| Method::Select
|
||||
| Method::Insert
|
||||
| Method::Create
|
||||
| Method::Update
|
||||
| Method::Upsert
|
||||
| Method::Merge
|
||||
| Method::Patch
|
||||
| Method::Delete
|
||||
| Method::Version
|
||||
| Method::Query
|
||||
| Method::Relate
|
||||
| Method::Run
|
||||
| Method::GraphQL
|
||||
| Method::InsertRelation
|
||||
| Method::Unknown
|
||||
)
|
||||
|
|
|
@ -2828,9 +2828,11 @@ impl Value {
|
|||
matches!(
|
||||
self,
|
||||
Value::None
|
||||
| Value::Null | Value::Array(_)
|
||||
| Value::Null
|
||||
| Value::Array(_)
|
||||
| Value::Block(_)
|
||||
| Value::Bool(_) | Value::Datetime(_)
|
||||
| Value::Bool(_)
|
||||
| Value::Datetime(_)
|
||||
| Value::Duration(_)
|
||||
| Value::Geometry(_)
|
||||
| Value::Number(_)
|
||||
|
|
|
@ -745,13 +745,17 @@ impl Parser<'_> {
|
|||
matches!(
|
||||
kind,
|
||||
t!("ANALYZE")
|
||||
| t!("BEGIN") | t!("BREAK")
|
||||
| t!("CANCEL") | t!("COMMIT")
|
||||
| t!("CONTINUE") | t!("FOR")
|
||||
| t!("INFO") | t!("KILL")
|
||||
| t!("LIVE") | t!("OPTION")
|
||||
| t!("BEGIN")
|
||||
| t!("BREAK")
|
||||
| t!("CANCEL")
|
||||
| t!("COMMIT")
|
||||
| t!("CONTINUE")
|
||||
| t!("FOR") | t!("INFO")
|
||||
| t!("KILL") | t!("LIVE")
|
||||
| t!("OPTION")
|
||||
| t!("LET") | t!("SHOW")
|
||||
| t!("SLEEP") | t!("THROW")
|
||||
| t!("SLEEP")
|
||||
| t!("THROW")
|
||||
| t!("USE")
|
||||
)
|
||||
}
|
||||
|
@ -893,15 +897,17 @@ impl Parser<'_> {
|
|||
t,
|
||||
t!("NONE")
|
||||
| t!("NULL") | t!("true")
|
||||
| t!("false") | t!("r\"")
|
||||
| t!("r'") | t!("d\"")
|
||||
| t!("d'") | t!("u\"")
|
||||
| t!("u'") | t!("\"")
|
||||
| t!("'") | t!("+")
|
||||
| t!("-") | TokenKind::Number(_)
|
||||
| t!("false")
|
||||
| t!("r\"") | t!("r'")
|
||||
| t!("d\"") | t!("d'")
|
||||
| t!("u\"") | t!("u'")
|
||||
| t!("\"") | t!("'")
|
||||
| t!("+") | t!("-")
|
||||
| TokenKind::Number(_)
|
||||
| TokenKind::Digits
|
||||
| TokenKind::Duration
|
||||
| TokenKind::NaN | t!("$param")
|
||||
| TokenKind::NaN
|
||||
| t!("$param")
|
||||
| t!("[") | t!("{")
|
||||
| t!("(") | TokenKind::Keyword(_)
|
||||
| TokenKind::Language(_)
|
||||
|
@ -915,10 +921,14 @@ impl Parser<'_> {
|
|||
| TokenKind::DurationSuffix(
|
||||
// All except Micro unicode
|
||||
DurationSuffix::Nano
|
||||
| DurationSuffix::Micro | DurationSuffix::Milli
|
||||
| DurationSuffix::Second | DurationSuffix::Minute
|
||||
| DurationSuffix::Hour | DurationSuffix::Day
|
||||
| DurationSuffix::Week | DurationSuffix::Year
|
||||
| DurationSuffix::Micro
|
||||
| DurationSuffix::Milli
|
||||
| DurationSuffix::Second
|
||||
| DurationSuffix::Minute
|
||||
| DurationSuffix::Hour
|
||||
| DurationSuffix::Day
|
||||
| DurationSuffix::Week
|
||||
| DurationSuffix::Year
|
||||
)
|
||||
)
|
||||
}
|
||||
|
|
|
@ -78,20 +78,30 @@ impl Parser<'_> {
|
|||
matches!(
|
||||
kind,
|
||||
t!("ACCESS")
|
||||
| t!("ALTER") | t!("ANALYZE")
|
||||
| t!("BEGIN") | t!("BREAK")
|
||||
| t!("CANCEL") | t!("COMMIT")
|
||||
| t!("CONTINUE") | t!("CREATE")
|
||||
| t!("DEFINE") | t!("DELETE")
|
||||
| t!("ALTER")
|
||||
| t!("ANALYZE")
|
||||
| t!("BEGIN")
|
||||
| t!("BREAK")
|
||||
| t!("CANCEL")
|
||||
| t!("COMMIT")
|
||||
| t!("CONTINUE")
|
||||
| t!("CREATE")
|
||||
| t!("DEFINE")
|
||||
| t!("DELETE")
|
||||
| t!("FOR") | t!("IF")
|
||||
| t!("INFO") | t!("INSERT")
|
||||
| t!("KILL") | t!("LIVE")
|
||||
| t!("OPTION") | t!("REBUILD")
|
||||
| t!("RETURN") | t!("RELATE")
|
||||
| t!("REMOVE") | t!("SELECT")
|
||||
| t!("OPTION")
|
||||
| t!("REBUILD")
|
||||
| t!("RETURN")
|
||||
| t!("RELATE")
|
||||
| t!("REMOVE")
|
||||
| t!("SELECT")
|
||||
| t!("LET") | t!("SHOW")
|
||||
| t!("SLEEP") | t!("THROW")
|
||||
| t!("UPDATE") | t!("UPSERT")
|
||||
| t!("SLEEP")
|
||||
| t!("THROW")
|
||||
| t!("UPDATE")
|
||||
| t!("UPSERT")
|
||||
| t!("USE")
|
||||
)
|
||||
}
|
||||
|
|
|
@ -30,10 +30,14 @@ impl Parser<'_> {
|
|||
| TokenKind::DurationSuffix(
|
||||
// All except Micro unicode
|
||||
DurationSuffix::Nano
|
||||
| DurationSuffix::Micro | DurationSuffix::Milli
|
||||
| DurationSuffix::Second | DurationSuffix::Minute
|
||||
| DurationSuffix::Hour | DurationSuffix::Day
|
||||
| DurationSuffix::Week | DurationSuffix::Year
|
||||
| DurationSuffix::Micro
|
||||
| DurationSuffix::Milli
|
||||
| DurationSuffix::Second
|
||||
| DurationSuffix::Minute
|
||||
| DurationSuffix::Hour
|
||||
| DurationSuffix::Day
|
||||
| DurationSuffix::Week
|
||||
| DurationSuffix::Year
|
||||
)
|
||||
)
|
||||
}
|
||||
|
@ -51,17 +55,18 @@ impl Parser<'_> {
|
|||
| TokenKind::DatetimeChars(_)
|
||||
| TokenKind::Exponent
|
||||
| TokenKind::NumberSuffix(_)
|
||||
| TokenKind::NaN | TokenKind::DurationSuffix(
|
||||
// All except Micro unicode
|
||||
DurationSuffix::Nano
|
||||
| DurationSuffix::Micro
|
||||
| DurationSuffix::Milli
|
||||
| DurationSuffix::Second
|
||||
| DurationSuffix::Minute
|
||||
| DurationSuffix::Hour
|
||||
| DurationSuffix::Day
|
||||
| DurationSuffix::Week
|
||||
)
|
||||
| TokenKind::NaN
|
||||
| TokenKind::DurationSuffix(
|
||||
// All except Micro unicode
|
||||
DurationSuffix::Nano
|
||||
| DurationSuffix::Micro
|
||||
| DurationSuffix::Milli
|
||||
| DurationSuffix::Second
|
||||
| DurationSuffix::Minute
|
||||
| DurationSuffix::Hour
|
||||
| DurationSuffix::Day
|
||||
| DurationSuffix::Week
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
|
|
|
@ -60,7 +60,7 @@ pub(crate) fn endpoint_valid(v: &str) -> Result<String, String> {
|
|||
let scheme = split_endpoint(v).0;
|
||||
match scheme {
|
||||
"http" | "https" | "ws" | "wss" | "fdb" | "mem" | "rocksdb" | "surrealkv" | "file"
|
||||
| "tikv" => Ok(v.to_string()),
|
||||
| "surrealcs" | "tikv" => Ok(v.to_string()),
|
||||
_ => Err(String::from("Provide a valid database connection string")),
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue