pub struct Struct<T: SqlStruct> {
pub flavor: Flavor,
/* private fields */
}Fields§
§flavor: FlavorImplementations§
Source§impl<T: SqlStruct> Struct<T>
impl<T: SqlStruct> Struct<T>
pub fn new() -> Self
Sourcepub fn with_field_mapper(&self, mapper: FieldMapperFunc) -> Self
pub fn with_field_mapper(&self, mapper: FieldMapperFunc) -> Self
WithFieldMapper: return a shadow copy with a different mapper.
- Passing
identity_mapper()matches the effect of a nil mapper.
Sourcepub fn for_flavor(&self, flavor: Flavor) -> Self
pub fn for_flavor(&self, flavor: Flavor) -> Self
ForFlavor: return a shadow copy with a different flavor.
Sourcepub fn with_tag(&self, tags: impl IntoIterator<Item = &'static str>) -> Self
pub fn with_tag(&self, tags: impl IntoIterator<Item = &'static str>) -> Self
WithTag: return a shadow copy with additional tags.
Sourcepub fn without_tag(&self, tags: impl IntoIterator<Item = &'static str>) -> Self
pub fn without_tag(&self, tags: impl IntoIterator<Item = &'static str>) -> Self
WithoutTag: return a shadow copy excluding specific tags.
Sourcepub fn columns_for_tag(&self, tag: &str) -> Option<Vec<String>>
pub fn columns_for_tag(&self, tag: &str) -> Option<Vec<String>>
ColumnsForTag: return columns for a specific tag; None if tag not defined.
Sourcepub fn values(&self, v: &T) -> Vec<Arg>
pub fn values(&self, v: &T) -> Vec<Arg>
Values: return values for write in the same order as columns().
Sourcepub fn values_for_tag(&self, tag: &str, v: &T) -> Option<Vec<Arg>>
pub fn values_for_tag(&self, tag: &str, v: &T) -> Option<Vec<Arg>>
ValuesForTag: values restricted to a tag; None if tag not defined.
Sourcepub fn foreach_read(&self, trans: impl FnMut(&str, bool, &FieldMeta))
pub fn foreach_read(&self, trans: impl FnMut(&str, bool, &FieldMeta))
ForeachRead: iterate readable fields.
dbtag: db tag (may be empty)is_quoted: whether the column needs quotingfield_meta: Rust-side metadata instead of reflect.StructField
Sourcepub fn foreach_write(&self, trans: impl FnMut(&str, bool, &FieldMeta))
pub fn foreach_write(&self, trans: impl FnMut(&str, bool, &FieldMeta))
ForeachWrite: iterate writable fields.
Sourcepub fn addr<'a>(&self, st: &'a mut T) -> Vec<ScanCell<'a>>
pub fn addr<'a>(&self, st: &'a mut T) -> Vec<ScanCell<'a>>
Addr: return scan targets for readable fields.
Sourcepub fn addr_for_tag<'a>(
&self,
tag: &str,
st: &'a mut T,
) -> Option<Vec<ScanCell<'a>>>
pub fn addr_for_tag<'a>( &self, tag: &str, st: &'a mut T, ) -> Option<Vec<ScanCell<'a>>>
AddrForTag: scan targets filtered by tag; None if tag not defined.
Sourcepub fn addr_with_cols<'a>(
&self,
cols: &[&str],
st: &'a mut T,
) -> Option<Vec<ScanCell<'a>>>
pub fn addr_with_cols<'a>( &self, cols: &[&str], st: &'a mut T, ) -> Option<Vec<ScanCell<'a>>>
AddrWithCols: scan targets for specific columns; None if any column is missing.
pub fn select_from(&self, table: &str) -> SelectBuilder
Sourcepub fn select_from_for_tag(&self, table: &str, tag: &str) -> SelectBuilder
pub fn select_from_for_tag(&self, table: &str, tag: &str) -> SelectBuilder
SelectFromForTag: build SELECT for a tag (deprecated).
pub fn update(&self, table: &str, value: &T) -> UpdateBuilder
Sourcepub fn update_for_tag(&self, table: &str, tag: &str, value: &T) -> UpdateBuilder
pub fn update_for_tag(&self, table: &str, tag: &str, value: &T) -> UpdateBuilder
UpdateForTag: build UPDATE for a tag (deprecated).
pub fn delete_from(&self, table: &str) -> DeleteBuilder
pub fn insert_into<'a>(
&self,
table: &str,
rows: impl IntoIterator<Item = &'a T>,
) -> InsertBuilderwhere
T: 'a,
Sourcepub fn insert_into_for_tag<'a>(
&self,
table: &str,
tag: &str,
rows: impl IntoIterator<Item = &'a T>,
) -> InsertBuilderwhere
T: 'a,
pub fn insert_into_for_tag<'a>(
&self,
table: &str,
tag: &str,
rows: impl IntoIterator<Item = &'a T>,
) -> InsertBuilderwhere
T: 'a,
InsertIntoForTag: build INSERT for a tag (deprecated).
pub fn insert_ignore_into_for_tag<'a>(
&self,
table: &str,
tag: &str,
rows: impl IntoIterator<Item = &'a T>,
) -> InsertBuilderwhere
T: 'a,
pub fn replace_into_for_tag<'a>(
&self,
table: &str,
tag: &str,
rows: impl IntoIterator<Item = &'a T>,
) -> InsertBuilderwhere
T: 'a,
Sourcepub fn insert_into_any<'a>(
&self,
table: &str,
values: impl IntoIterator<Item = &'a dyn Any>,
) -> InsertBuilderwhere
T: 'static,
pub fn insert_into_any<'a>(
&self,
table: &str,
values: impl IntoIterator<Item = &'a dyn Any>,
) -> InsertBuilderwhere
T: 'static,
InsertIntoAny: ignore values that are not of type T (like Go’s permissive interface slice).