Skip to main content

surrealdb_expr/expr/convert/statements/define/
access.rs

1//! `sql` -> `expr` conversions for [`crate::sql::statements::define::access`].
2//!
3//! Lives in core rather than beside the AST: `surrealdb-sql` sits below
4//! core, so it cannot name `expr` types.
5
6use crate::sql::statements::define::access::*;
7
8impl From<DefineAccessStatement> for crate::expr::statements::DefineAccessStatement {
9	fn from(v: DefineAccessStatement) -> Self {
10		crate::expr::statements::DefineAccessStatement {
11			kind: v.kind.into(),
12			name: v.name.into(),
13			base: v.base.into(),
14			access_type: v.access_type.into(),
15			authenticate: v.authenticate.map(Into::into),
16			context: v.context.map(Into::into),
17			duration: v.duration.into(),
18			comment: v.comment.into(),
19		}
20	}
21}
22
23impl From<crate::expr::statements::DefineAccessStatement> for DefineAccessStatement {
24	fn from(v: crate::expr::statements::DefineAccessStatement) -> Self {
25		DefineAccessStatement {
26			kind: v.kind.into(),
27			name: v.name.into(),
28			base: v.base.into(),
29			access_type: v.access_type.into(),
30			authenticate: v.authenticate.map(Into::into),
31			context: v.context.map(Into::into),
32			duration: v.duration.into(),
33			comment: v.comment.into(),
34		}
35	}
36}