pub struct CrudNamingConfig {
pub function_schema: Option<String>,
pub function_naming: Option<CrudNamingPreset>,
pub create_template: Option<String>,
pub update_template: Option<String>,
pub delete_template: Option<String>,
}Expand description
CRUD function naming configuration, compiled from [crud] in fraiseql.toml.
When a mutation’s sql_source is absent, the compiler resolves the PostgreSQL
function name using these templates and the entity name derived from the
mutation’s return_type.
Precedence (highest first):
- Explicit
sql_sourceon the mutation — always wins. - Per-operation custom template (
create_template,update_template,delete_template). - Built-in preset (
function_naming = "trinity").
function_schema is applied as a prefix to the resolved name
(e.g. "app" + "create_user" → "app.create_user").
Fields§
§function_schema: Option<String>PostgreSQL schema prefix (e.g. "app" → "app.create_user").
function_naming: Option<CrudNamingPreset>Built-in naming preset (expands to fixed templates).
create_template: Option<String>Custom template for CREATE mutations (e.g. "insert_{entity}").
update_template: Option<String>Custom template for UPDATE mutations.
delete_template: Option<String>Custom template for DELETE mutations.
Implementations§
Source§impl CrudNamingConfig
impl CrudNamingConfig
Sourcepub fn resolve(&self, operation: &str, entity: &str) -> Option<String>
pub fn resolve(&self, operation: &str, entity: &str) -> Option<String>
Resolve a PostgreSQL function name for the given CRUD operation and entity.
Returns None if neither a custom template nor a preset can satisfy the
operation. The caller is responsible for emitting a compile error in that
case.
operation is compared case-insensitively ("CREATE", "create", etc.).
entity should already be in snake_case (e.g. "user_profile").
Trait Implementations§
Source§impl Clone for CrudNamingConfig
impl Clone for CrudNamingConfig
Source§fn clone(&self) -> CrudNamingConfig
fn clone(&self) -> CrudNamingConfig
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for CrudNamingConfig
impl Debug for CrudNamingConfig
Source§impl Default for CrudNamingConfig
impl Default for CrudNamingConfig
Source§fn default() -> CrudNamingConfig
fn default() -> CrudNamingConfig
Source§impl<'de> Deserialize<'de> for CrudNamingConfigwhere
CrudNamingConfig: Default,
impl<'de> Deserialize<'de> for CrudNamingConfigwhere
CrudNamingConfig: Default,
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl PartialEq for CrudNamingConfig
impl PartialEq for CrudNamingConfig
Source§impl Serialize for CrudNamingConfig
impl Serialize for CrudNamingConfig
impl Eq for CrudNamingConfig
impl StructuralPartialEq for CrudNamingConfig
Auto Trait Implementations§
impl Freeze for CrudNamingConfig
impl RefUnwindSafe for CrudNamingConfig
impl Send for CrudNamingConfig
impl Sync for CrudNamingConfig
impl Unpin for CrudNamingConfig
impl UnsafeUnpin for CrudNamingConfig
impl UnwindSafe for CrudNamingConfig
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more