Skip to main content

Crate reef

Crate reef 

Source
Expand description

§Reef

Runtime crate for Reef apps. Today this provides:

  • The #[reef::table] schema-as-code attribute (re-exported from reef-macros)
  • Json and Jsonb newtypes for typed JSON columns

Future versions will add Db helpers and Dioxus convenience re-exports.

§Schema-as-code

use reef::{Json, Jsonb};

#[reef::table]
pub struct User {
    #[column(primary_key)]
    pub id: i64,
    #[column(unique)]
    pub email: String,
    pub tags: Json<Vec<String>>,
    pub metadata: Jsonb<UserMetadata>,
}

Structs§

Json
Wrap a serde-serializable value to mark a column as JSON-stored TEXT.
Jsonb
Wrap a serde-serializable value to mark a column as JSONB-stored BLOB.

Attribute Macros§

table
Mark a struct as a SQL table.