datatypes::types::cast

Function cast_with_opt

Source
pub fn cast_with_opt(
    src_value: Value,
    dest_type: &ConcreteDataType,
    cast_option: &CastOption,
) -> Result<Value>
Expand description

Cast the value to dest_type with CastOption.

§Arguments

  • src_value - The value to be casted.
  • dest_type - The destination type.
  • cast_option - The CastOption.

§Returns

If success, return the casted value. If CastOption’s strict is true, return an error if the cast fails. If CastOption’s strict is false, return NULL if the cast fails.