surreal_derive/lib.rs
1use derive::value::expand_derive_from_value;
2use proc_macro::TokenStream;
3use syn::{parse_macro_input, DeriveInput};
4
5mod derive;
6
7#[proc_macro_derive(FromValue)]
8pub fn from_value(input: TokenStream) -> TokenStream {
9 let DeriveInput { ident, data, .. } = parse_macro_input!(input);
10 match expand_derive_from_value(ident, data) {
11 Ok(tokenstream) => tokenstream.into(),//panic!("{}", tokenstream.to_string()),
12 Err(e) => e.into_compile_error().into(),
13 }
14}
15
16// surreal_query!(SQL string, TypeToReturn, Args/Obj)
17// If it has a type to return then return that type in a result
18// If it doesn't have a type then return a Vec<Response>
19// Destructure object into a Map and check that the query has named fields in case of an object query
20// In case of arg query, then count arguments and put them in order inside the query.
21// Start an in memory database and test that query on each build? Arg cancellable
22
23/*
24#[proc_macro_derive(ToValue)]
25pub fn to_value(input: TokenStream) -> TokenStream {
26 let DeriveInput { ident, data, .. } = parse_macro_input!(input);
27 match expand_derive_from_value(ident, data) {
28 Ok(tokenstream) => tokenstream.into(),//panic!("{}", tokenstream.to_string()),
29 Err(e) => e.into_compile_error().into(),
30 }
31 input
32}*/