DEFAULT_FN

Constant DEFAULT_FN 

Source
pub const DEFAULT_FN: ColumnMarker;
Expand description

Specifies a function to generate default values at runtime.

The function is called for each insert when no value is provided.

§Example

#[column(DEFAULT_FN = Uuid::new_v4)]
id: Uuid,

§Difference from DEFAULT

  • DEFAULT_FN: Calls the function at runtime for each insert (e.g., UUID generation)
  • DEFAULT: Uses a fixed compile-time value