grounddb-codegen
Compile-time code generation for GroundDB.
Reads a schema.yaml and generates a complete Rust source file with:
- Typed structs for each collection (e.g.,
User,Post) - Enums for fields with
enumconstraints (e.g.,UserRole,PostStatus) - Partial-update structs where all fields are
Option(e.g.,UserPartial) - View row structs derived from SQL SELECT columns (e.g.,
PostFeedRow) - Query parameter structs for parameterized views (e.g.,
PostCommentsParams) StoreExttrait with typed collection accessors and view methods
Setup
Add to your Cargo.toml:
[]
= "1"
Create a build.rs:
Include the generated module:
use *;
What Gets Generated
Given a schema with a users collection:
collections:
users:
path: "users/{name}.md"
fields:
name:
email:
role:
The codegen produces:
For full documentation, see the repository README.