mirror of
https://github.com/GreptimeTeam/greptimedb.git
synced 2026-06-02 13:20:40 +00:00
refactor: remove optional from the protos (#756)
This commit is contained in:
@@ -283,7 +283,7 @@ pub fn sql_column_def_to_grpc_column_def(col: ColumnDef) -> Result<api::v1::Colu
|
||||
name,
|
||||
datatype: data_type,
|
||||
is_nullable,
|
||||
default_constraint,
|
||||
default_constraint: default_constraint.unwrap_or_default(),
|
||||
})
|
||||
}
|
||||
|
||||
@@ -588,7 +588,7 @@ mod tests {
|
||||
assert_eq!("col", grpc_column_def.name);
|
||||
assert!(grpc_column_def.is_nullable); // nullable when options are empty
|
||||
assert_eq!(ColumnDataType::Float64 as i32, grpc_column_def.datatype);
|
||||
assert_eq!(None, grpc_column_def.default_constraint);
|
||||
assert!(grpc_column_def.default_constraint.is_empty());
|
||||
|
||||
// test not null
|
||||
let column_def = ColumnDef {
|
||||
|
||||
@@ -56,7 +56,7 @@ impl TryFrom<AlterTable> for AlterExpr {
|
||||
type Error = crate::error::Error;
|
||||
|
||||
fn try_from(value: AlterTable) -> Result<Self, Self::Error> {
|
||||
let (catalog, schema, table) = table_idents_to_full_name(&value.table_name)?;
|
||||
let (catalog_name, schema_name, table_name) = table_idents_to_full_name(&value.table_name)?;
|
||||
|
||||
let kind = match value.alter_operation {
|
||||
AlterTableOperation::AddConstraint(_) => {
|
||||
@@ -80,9 +80,9 @@ impl TryFrom<AlterTable> for AlterExpr {
|
||||
}
|
||||
};
|
||||
let expr = AlterExpr {
|
||||
catalog_name: Some(catalog),
|
||||
schema_name: Some(schema),
|
||||
table_name: table,
|
||||
catalog_name,
|
||||
schema_name,
|
||||
table_name,
|
||||
kind: Some(kind),
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user