#![deny(unused_crate_dependencies)]
pub mod config;
pub mod constants;
pub mod defaults;
pub mod graphql;
pub mod manifest;
pub mod utils;
use proc_macro2::TokenStream;
use quote::quote;
pub const MAX_ARRAY_LENGTH: usize = 2500;
#[derive(Default, Clone, Debug)]
pub enum ExecutionSource {
Native,
#[default]
Wasm,
}
impl ExecutionSource {
pub fn async_awaitness(&self) -> (TokenStream, TokenStream) {
match self {
Self::Native => (quote! {async}, quote! {.await}),
Self::Wasm => (quote! {}, quote! {}),
}
}
}
pub fn fully_qualified_namespace(namespace: &str, identifier: &str) -> String {
format!("{}_{}", namespace, identifier)
}
pub fn join_table_name(a: &str, b: &str) -> String {
format!("{}s_{}s", a, b)
}
pub fn join_table_typedefs_name(join_table_name: &str) -> (String, String) {
let mut parts = join_table_name.split('_');
let a = parts.next().unwrap();
let b = parts.next().unwrap();
(a[0..a.len() - 1].to_string(), b[0..b.len() - 1].to_string())
}