surrealdb_expr/expr/
script.rs1use std::ops::Deref;
2use std::str;
3
4#[derive(Clone, Debug, Default, Eq, PartialEq, PartialOrd, Hash)]
5pub struct Script(pub String);
6
7impl From<String> for Script {
8 fn from(s: String) -> Self {
9 Self(s)
10 }
11}
12
13impl From<&str> for Script {
14 fn from(s: &str) -> Self {
15 Self::from(String::from(s))
16 }
17}
18
19impl Deref for Script {
20 type Target = String;
21
22 fn deref(&self) -> &Self::Target {
23 &self.0
24 }
25}
26
27impl surrealdb_types::ToSql for Script {
28 fn fmt_sql(&self, f: &mut String, fmt: surrealdb_types::SqlFormat) {
29 let sql_script: crate::sql::Script = self.clone().into();
30 sql_script.fmt_sql(f, fmt);
31 }
32}