Skip to main content

surql_parser/upstream/sql/
script.rs

1use std::ops::Deref;
2use std::str;
3use surrealdb_types::{SqlFormat, ToSql};
4#[derive(Clone, Debug, Default, Eq, PartialEq, PartialOrd, Hash)]
5#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
6pub struct Script(#[cfg_attr(feature = "arbitrary", arbitrary(default))] pub String);
7impl From<String> for Script {
8	fn from(s: String) -> Self {
9		Self(s)
10	}
11}
12impl From<&str> for Script {
13	fn from(s: &str) -> Self {
14		Self::from(String::from(s))
15	}
16}
17impl Deref for Script {
18	type Target = String;
19	fn deref(&self) -> &Self::Target {
20		&self.0
21	}
22}
23impl ToSql for Script {
24	fn fmt_sql(&self, f: &mut String, fmt: SqlFormat) {
25		self.0.fmt_sql(f, fmt)
26	}
27}