Ensure DEFINE and REMOVE statements are serialized with full field information

This commit is contained in:
Tobie Morgan Hitchcock 2023-04-02 00:28:01 +01:00
parent 683c1adbd4
commit 7bb89d5041
2 changed files with 23 additions and 1 deletions

View file

@ -119,6 +119,7 @@ pub fn define(i: &str) -> IResult<&str, DefineStatement> {
// -------------------------------------------------- // --------------------------------------------------
#[derive(Clone, Debug, Default, Eq, PartialEq, Serialize, Deserialize, Store, Hash)] #[derive(Clone, Debug, Default, Eq, PartialEq, Serialize, Deserialize, Store, Hash)]
#[format(Named)]
pub struct DefineNamespaceStatement { pub struct DefineNamespaceStatement {
pub name: Ident, pub name: Ident,
} }
@ -168,6 +169,7 @@ fn namespace(i: &str) -> IResult<&str, DefineNamespaceStatement> {
// -------------------------------------------------- // --------------------------------------------------
#[derive(Clone, Debug, Default, Eq, PartialEq, Serialize, Deserialize, Store, Hash)] #[derive(Clone, Debug, Default, Eq, PartialEq, Serialize, Deserialize, Store, Hash)]
#[format(Named)]
pub struct DefineDatabaseStatement { pub struct DefineDatabaseStatement {
pub name: Ident, pub name: Ident,
} }
@ -222,6 +224,7 @@ fn database(i: &str) -> IResult<&str, DefineDatabaseStatement> {
// -------------------------------------------------- // --------------------------------------------------
#[derive(Clone, Debug, Default, Eq, PartialEq, Serialize, Deserialize, Store, Hash)] #[derive(Clone, Debug, Default, Eq, PartialEq, Serialize, Deserialize, Store, Hash)]
#[format(Named)]
pub struct DefineFunctionStatement { pub struct DefineFunctionStatement {
pub name: Ident, pub name: Ident,
pub args: Vec<(Ident, Kind)>, pub args: Vec<(Ident, Kind)>,
@ -306,6 +309,7 @@ fn function(i: &str) -> IResult<&str, DefineFunctionStatement> {
// -------------------------------------------------- // --------------------------------------------------
#[derive(Clone, Debug, Default, Eq, PartialEq, Serialize, Deserialize, Store, Hash)] #[derive(Clone, Debug, Default, Eq, PartialEq, Serialize, Deserialize, Store, Hash)]
#[format(Named)]
pub struct DefineLoginStatement { pub struct DefineLoginStatement {
pub name: Ident, pub name: Ident,
pub base: Base, pub base: Base,
@ -429,6 +433,7 @@ fn login_hash(i: &str) -> IResult<&str, DefineLoginOption> {
// -------------------------------------------------- // --------------------------------------------------
#[derive(Clone, Debug, Default, Eq, PartialEq, Serialize, Deserialize, Store, Hash)] #[derive(Clone, Debug, Default, Eq, PartialEq, Serialize, Deserialize, Store, Hash)]
#[format(Named)]
pub struct DefineTokenStatement { pub struct DefineTokenStatement {
pub name: Ident, pub name: Ident,
pub base: Base, pub base: Base,
@ -548,6 +553,7 @@ fn token(i: &str) -> IResult<&str, DefineTokenStatement> {
// -------------------------------------------------- // --------------------------------------------------
#[derive(Clone, Debug, Default, Eq, PartialEq, Serialize, Deserialize, Store, Hash)] #[derive(Clone, Debug, Default, Eq, PartialEq, Serialize, Deserialize, Store, Hash)]
#[format(Named)]
pub struct DefineScopeStatement { pub struct DefineScopeStatement {
pub name: Ident, pub name: Ident,
pub code: String, pub code: String,
@ -670,6 +676,7 @@ fn scope_signin(i: &str) -> IResult<&str, DefineScopeOption> {
// -------------------------------------------------- // --------------------------------------------------
#[derive(Clone, Debug, Default, Eq, PartialEq, Serialize, Deserialize, Store, Hash)] #[derive(Clone, Debug, Default, Eq, PartialEq, Serialize, Deserialize, Store, Hash)]
#[format(Named)]
pub struct DefineParamStatement { pub struct DefineParamStatement {
pub name: Ident, pub name: Ident,
pub value: Value, pub value: Value,
@ -732,6 +739,7 @@ fn param(i: &str) -> IResult<&str, DefineParamStatement> {
// -------------------------------------------------- // --------------------------------------------------
#[derive(Clone, Debug, Default, Eq, PartialEq, Serialize, Deserialize, Store, Hash)] #[derive(Clone, Debug, Default, Eq, PartialEq, Serialize, Deserialize, Store, Hash)]
#[format(Named)]
pub struct DefineTableStatement { pub struct DefineTableStatement {
pub name: Ident, pub name: Ident,
pub drop: bool, pub drop: bool,
@ -916,6 +924,7 @@ fn table_permissions(i: &str) -> IResult<&str, DefineTableOption> {
// -------------------------------------------------- // --------------------------------------------------
#[derive(Clone, Debug, Default, Eq, PartialEq, Serialize, Deserialize, Store, Hash)] #[derive(Clone, Debug, Default, Eq, PartialEq, Serialize, Deserialize, Store, Hash)]
#[format(Named)]
pub struct DefineEventStatement { pub struct DefineEventStatement {
pub name: Ident, pub name: Ident,
pub what: Ident, pub what: Ident,
@ -998,14 +1007,15 @@ fn event(i: &str) -> IResult<&str, DefineEventStatement> {
// -------------------------------------------------- // --------------------------------------------------
#[derive(Clone, Debug, Default, Eq, PartialEq, Serialize, Deserialize, Store, Hash)] #[derive(Clone, Debug, Default, Eq, PartialEq, Serialize, Deserialize, Store, Hash)]
#[format(Named)]
pub struct DefineFieldStatement { pub struct DefineFieldStatement {
pub name: Idiom, pub name: Idiom,
pub what: Ident, pub what: Ident,
pub flex: bool,
pub kind: Option<Kind>, pub kind: Option<Kind>,
pub value: Option<Value>, pub value: Option<Value>,
pub assert: Option<Value>, pub assert: Option<Value>,
pub permissions: Permissions, pub permissions: Permissions,
pub flex: bool,
} }
impl DefineFieldStatement { impl DefineFieldStatement {
@ -1161,6 +1171,7 @@ fn field_permissions(i: &str) -> IResult<&str, DefineFieldOption> {
// -------------------------------------------------- // --------------------------------------------------
#[derive(Clone, Debug, Default, Eq, PartialEq, Serialize, Deserialize, Store, Hash)] #[derive(Clone, Debug, Default, Eq, PartialEq, Serialize, Deserialize, Store, Hash)]
#[format(Named)]
pub struct DefineIndexStatement { pub struct DefineIndexStatement {
pub name: Ident, pub name: Ident,
pub what: Ident, pub what: Ident,

View file

@ -100,6 +100,7 @@ pub fn remove(i: &str) -> IResult<&str, RemoveStatement> {
// -------------------------------------------------- // --------------------------------------------------
#[derive(Clone, Debug, Default, Eq, PartialEq, Serialize, Deserialize, Store, Hash)] #[derive(Clone, Debug, Default, Eq, PartialEq, Serialize, Deserialize, Store, Hash)]
#[format(Named)]
pub struct RemoveNamespaceStatement { pub struct RemoveNamespaceStatement {
pub name: Ident, pub name: Ident,
} }
@ -156,6 +157,7 @@ fn namespace(i: &str) -> IResult<&str, RemoveNamespaceStatement> {
// -------------------------------------------------- // --------------------------------------------------
#[derive(Clone, Debug, Default, Eq, PartialEq, Serialize, Deserialize, Store, Hash)] #[derive(Clone, Debug, Default, Eq, PartialEq, Serialize, Deserialize, Store, Hash)]
#[format(Named)]
pub struct RemoveDatabaseStatement { pub struct RemoveDatabaseStatement {
pub name: Ident, pub name: Ident,
} }
@ -212,6 +214,7 @@ fn database(i: &str) -> IResult<&str, RemoveDatabaseStatement> {
// -------------------------------------------------- // --------------------------------------------------
#[derive(Clone, Debug, Default, Eq, PartialEq, Serialize, Deserialize, Store, Hash)] #[derive(Clone, Debug, Default, Eq, PartialEq, Serialize, Deserialize, Store, Hash)]
#[format(Named)]
pub struct RemoveFunctionStatement { pub struct RemoveFunctionStatement {
pub name: Ident, pub name: Ident,
} }
@ -273,6 +276,7 @@ fn function(i: &str) -> IResult<&str, RemoveFunctionStatement> {
// -------------------------------------------------- // --------------------------------------------------
#[derive(Clone, Debug, Default, Eq, PartialEq, Serialize, Deserialize, Store, Hash)] #[derive(Clone, Debug, Default, Eq, PartialEq, Serialize, Deserialize, Store, Hash)]
#[format(Named)]
pub struct RemoveLoginStatement { pub struct RemoveLoginStatement {
pub name: Ident, pub name: Ident,
pub base: Base, pub base: Base,
@ -352,6 +356,7 @@ fn login(i: &str) -> IResult<&str, RemoveLoginStatement> {
// -------------------------------------------------- // --------------------------------------------------
#[derive(Clone, Debug, Default, Eq, PartialEq, Serialize, Deserialize, Store, Hash)] #[derive(Clone, Debug, Default, Eq, PartialEq, Serialize, Deserialize, Store, Hash)]
#[format(Named)]
pub struct RemoveTokenStatement { pub struct RemoveTokenStatement {
pub name: Ident, pub name: Ident,
pub base: Base, pub base: Base,
@ -446,6 +451,7 @@ fn token(i: &str) -> IResult<&str, RemoveTokenStatement> {
// -------------------------------------------------- // --------------------------------------------------
#[derive(Clone, Debug, Default, Eq, PartialEq, Serialize, Deserialize, Store, Hash)] #[derive(Clone, Debug, Default, Eq, PartialEq, Serialize, Deserialize, Store, Hash)]
#[format(Named)]
pub struct RemoveScopeStatement { pub struct RemoveScopeStatement {
pub name: Ident, pub name: Ident,
} }
@ -502,6 +508,7 @@ fn scope(i: &str) -> IResult<&str, RemoveScopeStatement> {
// -------------------------------------------------- // --------------------------------------------------
#[derive(Clone, Debug, Default, Eq, PartialEq, Serialize, Deserialize, Store, Hash)] #[derive(Clone, Debug, Default, Eq, PartialEq, Serialize, Deserialize, Store, Hash)]
#[format(Named)]
pub struct RemoveParamStatement { pub struct RemoveParamStatement {
pub name: Ident, pub name: Ident,
} }
@ -556,6 +563,7 @@ fn param(i: &str) -> IResult<&str, RemoveParamStatement> {
// -------------------------------------------------- // --------------------------------------------------
#[derive(Clone, Debug, Default, Eq, PartialEq, Serialize, Deserialize, Store, Hash)] #[derive(Clone, Debug, Default, Eq, PartialEq, Serialize, Deserialize, Store, Hash)]
#[format(Named)]
pub struct RemoveTableStatement { pub struct RemoveTableStatement {
pub name: Ident, pub name: Ident,
} }
@ -612,6 +620,7 @@ fn table(i: &str) -> IResult<&str, RemoveTableStatement> {
// -------------------------------------------------- // --------------------------------------------------
#[derive(Clone, Debug, Default, Eq, PartialEq, Serialize, Deserialize, Store, Hash)] #[derive(Clone, Debug, Default, Eq, PartialEq, Serialize, Deserialize, Store, Hash)]
#[format(Named)]
pub struct RemoveEventStatement { pub struct RemoveEventStatement {
pub name: Ident, pub name: Ident,
pub what: Ident, pub what: Ident,
@ -675,6 +684,7 @@ fn event(i: &str) -> IResult<&str, RemoveEventStatement> {
// -------------------------------------------------- // --------------------------------------------------
#[derive(Clone, Debug, Default, Eq, PartialEq, Serialize, Deserialize, Store, Hash)] #[derive(Clone, Debug, Default, Eq, PartialEq, Serialize, Deserialize, Store, Hash)]
#[format(Named)]
pub struct RemoveFieldStatement { pub struct RemoveFieldStatement {
pub name: Idiom, pub name: Idiom,
pub what: Ident, pub what: Ident,
@ -738,6 +748,7 @@ fn field(i: &str) -> IResult<&str, RemoveFieldStatement> {
// -------------------------------------------------- // --------------------------------------------------
#[derive(Clone, Debug, Default, Eq, PartialEq, Serialize, Deserialize, Store, Hash)] #[derive(Clone, Debug, Default, Eq, PartialEq, Serialize, Deserialize, Store, Hash)]
#[format(Named)]
pub struct RemoveIndexStatement { pub struct RemoveIndexStatement {
pub name: Ident, pub name: Ident,
pub what: Ident, pub what: Ident,