surrealdb_expr/expr/
model.rs1use surrealdb_strand::Strand;
2use surrealdb_types::{SqlFormat, ToSql};
3
4pub const ARGUMENTS: &str = "The model expects 1 argument. The argument can be either a number, an object, or an array of numbers.";
5
6pub fn get_model_path(ns: &str, db: &str, name: &str, version: &str, hash: &str) -> String {
7 format!("ml/{ns}/{db}/{name}-{version}-{hash}.surml")
8}
9
10#[derive(Clone, Debug, Default, Eq, PartialEq, Hash)]
11pub struct Model {
12 pub name: Strand,
13 pub version: Strand,
14}
15
16impl ToSql for Model {
17 fn fmt_sql(&self, f: &mut String, sql_fmt: SqlFormat) {
18 let stmt: crate::sql::model::Model = self.clone().into();
19 stmt.fmt_sql(f, sql_fmt);
20 }
21}