pub trait DefaultProvider: Send + Sync {
// Required methods
fn default_bytes(&self, field: &str, type_name: &str) -> Option<Vec<u8>>;
fn default_string(&self, field: &str, type_name: &str) -> Option<String>;
fn has_default(&self, field: &str) -> bool;
fn fields_with_defaults(&self) -> Vec<String>;
}Expand description
Default value provider for schema fields.
Implementations provide default values for fields in a schema, which are used when migrating data from older versions that lack certain fields.
Required Methods§
Sourcefn default_string(&self, field: &str, type_name: &str) -> Option<String>
fn default_string(&self, field: &str, type_name: &str) -> Option<String>
Get the default value for a field as a string representation.
This is useful for debugging and display purposes.
Sourcefn has_default(&self, field: &str) -> bool
fn has_default(&self, field: &str) -> bool
Check if a field has a default value.
Sourcefn fields_with_defaults(&self) -> Vec<String>
fn fields_with_defaults(&self) -> Vec<String>
Get all fields that have defaults.