9 releases (5 breaking)

0.5.0 Nov 8, 2024
0.4.1 Aug 2, 2024
0.4.0 Nov 17, 2023
0.3.0 Jul 25, 2023
0.0.1 Jun 28, 2023

#1519 in Database interfaces

Download history 8/week @ 2024-09-14 17/week @ 2024-09-21 13/week @ 2024-09-28 2/week @ 2024-10-05 56/week @ 2024-11-02 52/week @ 2024-11-09 7/week @ 2024-11-16 2/week @ 2024-11-23 10/week @ 2024-11-30

127 downloads per month

Apache-2.0

205KB
4.5K SLoC

Rust 3K SLoC // 0.0% comments GraphQL 1.5K SLoC // 0.0% comments

trustfall_stubgen

Given a Trustfall schema, autogenerate a high-quality Rust adapter stub fully wired up with all types, properties, and edges referenced in the schema.

First, install the CLI with: cargo install --locked trustfall_stubgen Then generate Trustfall adapter stubs for your schema with:

trustfall_stubgen --schema <your_schema.graphql> --target <output_directory>

Under the hood this directly calls the generate_rust_stub() function from this crate. This crate can also be used as a library, so you can call that function directly from your own code without going through the CLI.

The generated Trustfall adapter stub has the following structure:

file name purpose
adapter/mod.rs connects everything together
adapter/schema.graphql contains the schema for the adapter
adapter/adapter.rs contains the adapter implementation
adapter/vertex.rs contains the vertex type definition
adapter/entrypoints.rs contains the entry points where all queries must start
adapter/properties.rs contains the property implementations
adapter/edges.rs contains the edge implementations
adapter/tests.rs contains test code

See an example of a generated adapter stub from this crate's test suite.

Dependencies

~13MB
~298K SLoC