DeriveQueryable

Derive Macro DeriveQueryable 

Source
#[derive(DeriveQueryable)]
{
    // Attributes available to this derive:
    #[queryable]
}
Expand description

Derives the Queryable trait for a struct.

This is a standalone macro for domain entities that need to be queryable via ConfigMigrator but don’t have version information themselves.

§Attributes

  • #[queryable(entity = "name")]: Specifies the entity name (required). This must match the entity name used when registering migration paths.

§Examples

Basic usage:

use version_migrate::Queryable;

#[derive(Queryable)]
#[queryable(entity = "task")]
pub struct TaskEntity {
    pub id: String,
    pub title: String,
}

// Now can be used with ConfigMigrator
let tasks: Vec<TaskEntity> = config.query("tasks")?;

The entity name must match the Migrator registration:

let path = Migrator::define("task")  // ← This name
    .from::<TaskV1>()
    .into::<TaskEntity>();

#[derive(Queryable)]
#[queryable(entity = "task")]  // ← Must match
struct TaskEntity { ... }