MyGit

trustfall_stubgen-v0.2.1

obi1kenobi/trustfall

版本发布时间: 2023-07-01 04:02:49

obi1kenobi/trustfall最新发布版本:trustfall-v0.7.1(2023-11-18 05:35:14)

New crate: 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 this crate's CLI with: cargo install --locked trustfall_stubgen --features cli

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

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

相关地址:原始地址 下载(tar) 下载(zip)

查看:2023-07-01发行的版本