Skip to content

Improve borrowed BYTEA and nullable string setter ergonomics #57

Description

@alexeichhorn

Context

Two small value-input conveniences are currently missing.

Borrowed BYTEA values

BYTEA columns accept owned Vec<u8> values but not borrowed slices:

blob.data.eq(bytes.to_vec()); // works
blob.data.eq(bytes.as_slice()); // rejected

Support &[u8] where BYTEA values are currently accepted, including required and nullable columns, inserts, updates, and comparisons. dbkit may copy the slice internally because query binds must own their data.

Nullable active string setters

These currently work:

active.nullable_text.set("text".to_string());
active.nullable_text = "text".into();
active.nullable_text.set_null();

This convenience does not:

active.nullable_text.set("text");

Allow &str in ActiveValue<Option<String>>::set without weakening the generic setter or introducing ambiguity.

Requirements

  • Preserve set(T), set(Option<T>), direct .into() assignment, and set_null() behavior.
  • Preserve bare None inference where it currently works.
  • Do not introduce overlapping trait implementations or broader implicit conversions unrelated to these inputs.
  • Add focused compile-time coverage for the new and existing forms.

This is a low-priority ergonomics enhancement, not a correctness issue.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions