clementine_core::database::wrapper

Macro impl_text_wrapper_default

Source
macro_rules! impl_text_wrapper_default {
    ($wrapper:ident, $inner:ty) => { ... };
}
Expand description

Macro for implementing text-based SQL wrapper types using standard string conversion

This macro creates a wrapper type that uses the inner type’s default string conversion methods (to_string() and from_str()) for encoding/decoding to/from TEXT columns.

§Parameters

  • $wrapper: The name of the wrapper type to create
  • $inner: The inner type being wrapped

The macro creates a new type that wraps the inner type and implements:

  • SQLx Type trait to indicate TEXT column type
  • SQLx Encode trait for converting to database format
  • SQLx Decode trait for converting from database format