Skip to main content

surrealdb_expr/expr/statements/define/
table.rs

1use surrealdb_strand::Strand;
2
3use super::DefineKind;
4use crate::expr::changefeed::ChangeFeed;
5use crate::expr::permission::Permissions;
6use crate::expr::table_type::TableType;
7use crate::expr::{Expr, Literal, View};
8
9#[derive(Clone, Debug, Eq, PartialEq, Hash)]
10pub struct DefineTableStatement {
11	pub kind: DefineKind,
12	pub id: Option<u32>,
13	pub name: Expr,
14	pub drop: bool,
15	pub full: bool,
16	pub view: Option<View>,
17	pub permissions: Permissions,
18	pub changefeed: Option<ChangeFeed>,
19	pub comment: Expr,
20	pub table_type: TableType,
21	pub graphql_alias: Option<String>,
22	pub graphql_deprecated: Option<String>,
23	/// Inline adjacency cache cap (`INLINE EDGES <n>`).
24	pub inline_edges_cap: Option<u32>,
25	/// Inline reference cache cap (`INLINE REFERENCES <n>`).
26	pub inline_refs_cap: Option<u32>,
27}
28
29impl Default for DefineTableStatement {
30	fn default() -> Self {
31		Self {
32			kind: DefineKind::Default,
33			id: None,
34			name: Expr::Literal(Literal::String(Strand::default())),
35			drop: false,
36			full: false,
37			view: None,
38			permissions: Permissions::default(),
39			changefeed: None,
40			comment: Expr::Literal(Literal::None),
41			table_type: TableType::default(),
42			graphql_alias: None,
43			graphql_deprecated: None,
44			inline_edges_cap: None,
45			inline_refs_cap: None,
46		}
47	}
48}