clementine_core::database::wrapper

Macro impl_bytea_wrapper_custom

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

Macro for implementing BYTEA-based SQL wrapper types with custom encoding/decoding

ยงParameters

  • $wrapper: The name of the wrapper type to create
  • $inner: The inner type being wrapped
  • $encode: Expression for converting inner type to bytes
  • $decode: Expression for converting bytes back to inner type

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

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