A query engine for any combination of data sources. Query your files and APIs as if they were databases!
APACHE-2.0 License
Bot releases are visible (Hide)
A major new update to the Adapter
API in order to allow more flexibility when creating and composing adapters: #481
It requires tweaks to adapter implementations to make property and edge resolvers include the V: AsVertex<Self::Vertex> + 'a
generic parameter. In practice, this change should be possible to do with only find-and-replace, since other helper functions like accessor_property!()
or resolve_property_with()
had their APIs updated to dereference via AsVertex
as well. For example: https://github.com/obi1kenobi/trustfall-rustdoc-adapter/pull/305/files#diff-f6f5d3d9607240984eb0cbf4ebcf94307990abe1c5a2092756f48ef35798348f
@fold
early if it has no outputs and its count is never observed by the query: #423accessor_property!()
now has a form that allows specifying additional arguments for the function being called: https://github.com/obi1kenobi/trustfall/pull/513
repeatable
on @filter
directives by upgrading to a newer parser version.SchemaAdapter
supports.FieldValue
to make it cheaper to clone, which our APIs will now do a bit more freely.trustfall_derive
job name. by @obi1kenobi in https://github.com/obi1kenobi/trustfall/pull/412
as_arc_str()
and as_arc_slice()
methods on FieldValue
. by @obi1kenobi in https://github.com/obi1kenobi/trustfall/pull/414
cargo update
of fuzzing dependencies by @obi1kenobi in https://github.com/obi1kenobi/trustfall/pull/416
cargo update
of primary dependencies by @obi1kenobi in https://github.com/obi1kenobi/trustfall/pull/417
docs
properties to VertexType, Property, Edge
metaschema types. by @obi1kenobi in https://github.com/obi1kenobi/trustfall/pull/422
cargo update
of fuzzing dependencies by @obi1kenobi in https://github.com/obi1kenobi/trustfall/pull/436
cargo update
of primary dependencies by @obi1kenobi in https://github.com/obi1kenobi/trustfall/pull/437
cargo update
of fuzzing dependencies by @obi1kenobi in https://github.com/obi1kenobi/trustfall/pull/446
cargo update
of primary dependencies by @obi1kenobi in https://github.com/obi1kenobi/trustfall/pull/447
<1.0.172
. by @obi1kenobi in https://github.com/obi1kenobi/trustfall/pull/452
cargo update
of primary dependencies by @obi1kenobi in https://github.com/obi1kenobi/trustfall/pull/454
cargo update
of fuzzing dependencies by @obi1kenobi in https://github.com/obi1kenobi/trustfall/pull/453
cargo update
of fuzzing dependencies by @obi1kenobi in https://github.com/obi1kenobi/trustfall/pull/464
cargo update
of primary dependencies by @obi1kenobi in https://github.com/obi1kenobi/trustfall/pull/465
cargo update
of fuzzing dependencies by @obi1kenobi in https://github.com/obi1kenobi/trustfall/pull/468
cargo update
of primary dependencies by @obi1kenobi in https://github.com/obi1kenobi/trustfall/pull/467
cargo update
of primary dependencies by @obi1kenobi in https://github.com/obi1kenobi/trustfall/pull/469
cargo update
of fuzzing dependencies by @obi1kenobi in https://github.com/obi1kenobi/trustfall/pull/470
cargo update
of fuzzing dependencies by @obi1kenobi in https://github.com/obi1kenobi/trustfall/pull/471
cargo update
of primary dependencies by @obi1kenobi in https://github.com/obi1kenobi/trustfall/pull/472
cargo update
of fuzzing dependencies by @obi1kenobi in https://github.com/obi1kenobi/trustfall/pull/474
cargo update
of primary dependencies by @obi1kenobi in https://github.com/obi1kenobi/trustfall/pull/475
cargo update
of primary dependencies by @obi1kenobi in https://github.com/obi1kenobi/trustfall/pull/478
cargo update
of fuzzing dependencies by @obi1kenobi in https://github.com/obi1kenobi/trustfall/pull/477
cargo update
of fuzzing dependencies by @obi1kenobi in https://github.com/obi1kenobi/trustfall/pull/483
cargo update
of primary dependencies by @obi1kenobi in https://github.com/obi1kenobi/trustfall/pull/482
actions/checkout@v4
in GitHub Actions. by @obi1kenobi in https://github.com/obi1kenobi/trustfall/pull/486
actions-rust-lang/setup-rust-toolchain
action. by @obi1kenobi in https://github.com/obi1kenobi/trustfall/pull/485
once_cell
dependency from most of the repo's crates. by @obi1kenobi in https://github.com/obi1kenobi/trustfall/pull/489
cargo update
of fuzzing dependencies by @obi1kenobi in https://github.com/obi1kenobi/trustfall/pull/491
cargo update
of primary dependencies by @obi1kenobi in https://github.com/obi1kenobi/trustfall/pull/492
FUNDING.yml
file. by @obi1kenobi in https://github.com/obi1kenobi/trustfall/pull/493
__typename
handler branch in stubgen. by @obi1kenobi in https://github.com/obi1kenobi/trustfall/pull/500
cargo update
of fuzzing dependencies by @obi1kenobi in https://github.com/obi1kenobi/trustfall/pull/502
cargo update
of primary dependencies by @obi1kenobi in https://github.com/obi1kenobi/trustfall/pull/503
cargo update
of fuzzing dependencies by @obi1kenobi in https://github.com/obi1kenobi/trustfall/pull/505
cargo update
of primary dependencies by @obi1kenobi in https://github.com/obi1kenobi/trustfall/pull/506
cargo update
of primary dependencies by @obi1kenobi in https://github.com/obi1kenobi/trustfall/pull/508
cargo update
of fuzzing dependencies by @obi1kenobi in https://github.com/obi1kenobi/trustfall/pull/507
move
closures by default. by @obi1kenobi in https://github.com/obi1kenobi/trustfall/pull/509
cargo update
of fuzzing dependencies by @obi1kenobi in https://github.com/obi1kenobi/trustfall/pull/511
cargo update
of primary dependencies by @obi1kenobi in https://github.com/obi1kenobi/trustfall/pull/510
accessor_property!()
to pass arguments to called functions. by @obi1kenobi in https://github.com/obi1kenobi/trustfall/pull/513
resolve_with()
API and release v0.7.1 after yanking 0.7. by @obi1kenobi in https://github.com/obi1kenobi/trustfall/pull/516
Full Changelog: https://github.com/obi1kenobi/trustfall/compare/trustfall-v0.6.1...trustfall-v0.7.1
Published by obi1kenobi about 1 year ago
A maintenance release, upgrading trustfall_derive
to syn
v2 in an attempt to speed up compilation for our dependents by avoiding the use of multiple major versions of a large crate.
trustfall_derive
to syn
v2. by @obi1kenobi in https://github.com/obi1kenobi/trustfall/pull/411
Full Changelog: https://github.com/obi1kenobi/trustfall/compare/trustfall-v0.6.0...trustfall-v0.6.1
Published by obi1kenobi about 1 year ago
check_adapter_invariants()
(#389)trustfall_stubgen
(#352)TryIntoStruct
to unpack EdgeParameters
as well. by @obi1kenobi in https://github.com/obi1kenobi/trustfall/pull/350
trustfall_stubgen
. by @obi1kenobi in https://github.com/obi1kenobi/trustfall/pull/351
trustfall_stubgen
. by @obi1kenobi in https://github.com/obi1kenobi/trustfall/pull/352
actions: write
permission to auto-updater workflow. by @obi1kenobi in https://github.com/obi1kenobi/trustfall/pull/360
cargo update
of primary dependencies by @obi1kenobi in https://github.com/obi1kenobi/trustfall/pull/362
cargo update
of fuzzing dependencies by @obi1kenobi in https://github.com/obi1kenobi/trustfall/pull/365
cargo update
of primary dependencies by @obi1kenobi in https://github.com/obi1kenobi/trustfall/pull/370
cargo update
of fuzzing dependencies by @obi1kenobi in https://github.com/obi1kenobi/trustfall/pull/369
cargo update
of fuzzing dependencies by @obi1kenobi in https://github.com/obi1kenobi/trustfall/pull/376
cargo update
of primary dependencies by @obi1kenobi in https://github.com/obi1kenobi/trustfall/pull/377
cargo update
of fuzzing dependencies by @obi1kenobi in https://github.com/obi1kenobi/trustfall/pull/382
cargo update
of primary dependencies by @obi1kenobi in https://github.com/obi1kenobi/trustfall/pull/383
cli
feature in trustfall_stubgen
by default. by @obi1kenobi in https://github.com/obi1kenobi/trustfall/pull/388
__typename
in "items with allowed lints" example rustdoc query. by @obi1kenobi in https://github.com/obi1kenobi/trustfall/pull/391
cargo update
of fuzzing dependencies by @obi1kenobi in https://github.com/obi1kenobi/trustfall/pull/395
cargo update
of primary dependencies by @obi1kenobi in https://github.com/obi1kenobi/trustfall/pull/394
ron
from dependencies and move to dev-dependencies. by @obi1kenobi in https://github.com/obi1kenobi/trustfall/pull/398
chrono
from dependencies. Removes datetime value variant. by @obi1kenobi in https://github.com/obi1kenobi/trustfall/pull/399
Debug
output in helper panic message. by @obi1kenobi in https://github.com/obi1kenobi/trustfall/pull/401
FieldValue
cheaper to clone by Arc
-ing internally. by @obi1kenobi in https://github.com/obi1kenobi/trustfall/pull/400
vec!
with arrays by @nvzqz in https://github.com/obi1kenobi/trustfall/pull/402
test_field_value_into
nicer to work with by @nvzqz in https://github.com/obi1kenobi/trustfall/pull/403
Full Changelog: https://github.com/obi1kenobi/trustfall/compare/trustfall_stubgen-v0.2.2...trustfall_stubgen-v0.3.0
Published by obi1kenobi about 1 year ago
FieldValue::DateTime
variant has been removed since it used the unmaintained chrono
library (#399)FieldValue::String
and FieldValue::List
now use Arc
internally, making FieldValue
cheap to clone (#400)Adapter
implementations implement their schema and uphold invariants (#384)TryIntoStruct
can now also unpack EdgeParameters
(#343)SchemaAdapter
, it's now possible to query edge parameters' default values (#396)Adapter
implementations (#384)The new check_adapter_invariants()
function is a self-contained adapter tester that can ensure you didn't forget to implement any components of your adapter's schema. Using it is as simple as:
pub use trustfall::provider::check_adapter_invariants;
#[test]
fn ensure_adapter_satisfies_invariants() {
let adapter = todo!("get an `impl Adapter` type");
let schema = todo!("get a `&Schema` for our adapter");
check_adapter_invariants(schema, adapter);
}
In addition to catching incomplete schema implementation errors, it also catches violations of other Trustfall adapter invariants, such as context reordering or accidentally dropped data.
For more information, check out its docs: https://github.com/obi1kenobi/trustfall/blob/trustfall-v0.6.0/trustfall_core/src/interpreter/helpers/correctness.rs#L15-L78
The breaking changes should be immaterial to almost all users. Most use cases should be able to upgrade to Trustfall v0.6 without any changes to their own code.
trustfall_stubgen
and ensure deterministic stubs. by @obi1kenobi in https://github.com/obi1kenobi/trustfall/pull/331
trustfall_stubgen
. by @obi1kenobi in https://github.com/obi1kenobi/trustfall/pull/334
A-frontend
and add A-playground
label. by @obi1kenobi in https://github.com/obi1kenobi/trustfall/pull/336
SchemaAdapter
. by @obi1kenobi in https://github.com/obi1kenobi/trustfall/pull/337
TryIntoStruct
to unpack EdgeParameters
as well. by @obi1kenobi in https://github.com/obi1kenobi/trustfall/pull/350
trustfall_stubgen
. by @obi1kenobi in https://github.com/obi1kenobi/trustfall/pull/351
trustfall_stubgen
. by @obi1kenobi in https://github.com/obi1kenobi/trustfall/pull/352
actions: write
permission to auto-updater workflow. by @obi1kenobi in https://github.com/obi1kenobi/trustfall/pull/360
cargo update
of primary dependencies by @obi1kenobi in https://github.com/obi1kenobi/trustfall/pull/362
cargo update
of fuzzing dependencies by @obi1kenobi in https://github.com/obi1kenobi/trustfall/pull/365
cargo update
of primary dependencies by @obi1kenobi in https://github.com/obi1kenobi/trustfall/pull/370
cargo update
of fuzzing dependencies by @obi1kenobi in https://github.com/obi1kenobi/trustfall/pull/369
cargo update
of fuzzing dependencies by @obi1kenobi in https://github.com/obi1kenobi/trustfall/pull/376
cargo update
of primary dependencies by @obi1kenobi in https://github.com/obi1kenobi/trustfall/pull/377
cargo update
of fuzzing dependencies by @obi1kenobi in https://github.com/obi1kenobi/trustfall/pull/382
cargo update
of primary dependencies by @obi1kenobi in https://github.com/obi1kenobi/trustfall/pull/383
cli
feature in trustfall_stubgen
by default. by @obi1kenobi in https://github.com/obi1kenobi/trustfall/pull/388
__typename
in "items with allowed lints" example rustdoc query. by @obi1kenobi in https://github.com/obi1kenobi/trustfall/pull/391
cargo update
of fuzzing dependencies by @obi1kenobi in https://github.com/obi1kenobi/trustfall/pull/395
cargo update
of primary dependencies by @obi1kenobi in https://github.com/obi1kenobi/trustfall/pull/394
ron
from dependencies and move to dev-dependencies. by @obi1kenobi in https://github.com/obi1kenobi/trustfall/pull/398
chrono
from dependencies. Removes datetime value variant. by @obi1kenobi in https://github.com/obi1kenobi/trustfall/pull/399
Debug
output in helper panic message. by @obi1kenobi in https://github.com/obi1kenobi/trustfall/pull/401
FieldValue
cheaper to clone by Arc
-ing internally. by @obi1kenobi in https://github.com/obi1kenobi/trustfall/pull/400
vec!
with arrays by @nvzqz in https://github.com/obi1kenobi/trustfall/pull/402
test_field_value_into
nicer to work with by @nvzqz in https://github.com/obi1kenobi/trustfall/pull/403
Full Changelog: https://github.com/obi1kenobi/trustfall/compare/trustfall-v0.5.1...trustfall-v0.6.0
Published by obi1kenobi over 1 year ago
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.
Published by obi1kenobi over 1 year ago
Added a SchemaAdapter
that allows running Trustfall queries against Trustfall schemas, like so:
{
VertexType {
name @output
edge {
edge_name: name @output
parameter_: parameter @fold {
name @output
}
}
}
}
For a given schema, running this query returns all edges on all vertex types, together with a list of the parameters those edges take.
lazy_static
with once_cell
by @nvzqz in https://github.com/obi1kenobi/trustfall/pull/298
serde_type_serializer
by @nvzqz in https://github.com/obi1kenobi/trustfall/pull/297
trustfall-rustdoc-adapter
to power rustdoc Trustfall playground. by @obi1kenobi in https://github.com/obi1kenobi/trustfall/pull/306
--all-targets
flag to cargo test
command. by @obi1kenobi in https://github.com/obi1kenobi/trustfall/pull/307
supertrait
edge to rustdoc schema. by @obi1kenobi in https://github.com/obi1kenobi/trustfall/pull/309
DeserializeOwned
by @nvzqz in https://github.com/obi1kenobi/trustfall/pull/313
Vertex
-containing types by @nvzqz in https://github.com/obi1kenobi/trustfall/pull/314
FieldValue::as_f64()
conversion method. by @obi1kenobi in https://github.com/obi1kenobi/trustfall/pull/315
trustfall
and trustfall_core
to expose SchemaAdapter
. by @obi1kenobi in https://github.com/obi1kenobi/trustfall/pull/329
Full Changelog: https://github.com/obi1kenobi/trustfall/compare/trustfall-v0.5.0...trustfall-v0.5.1
Published by obi1kenobi over 1 year ago
execute_query()
now takes Arc<impl Adapter>
instead of Rc<impl Adapter>
for consistency with other APIs and easier use in web servers: #286resolve_coercion_using_schema()
helper method to simplify implementing adapters' resolve_coercion()
method.TryIntoStruct
trait for ergonomic result parsing into a struct, for example:use trustfall::TryIntoStruct;
// Define a struct whose field names and types match
// those returned by a query, and derive `serde::Deserialize` on it.
#[derive(Debug, PartialEq, Eq, serde::Deserialize)]
struct Output {
number: i64,
text: String,
}
// Elsewhere, we run a query that outputs a `number` integer
// and a `text` string field.
let query = r#"
{
Query {
number @output
text @output
}
}
"#;
let results: Vec<_> = execute_query(schema, adapter, query, variables)
.expect("bad query arguments")
.map(|v| v.try_into_struct().expect("struct definition did not match query result shape"))
.collect();
// The `try_into_struct()` call turned the query results into `Output` structs.
assert_eq!(
vec![
Output {
number: 42,
text: "the answer to everything".to_string(),
},
],
results,
);
Wrap your adapters in Arc
instead of Rc
before calling execute_query()
.
TryIntoStruct
trait for ergonomic result parsing into a struct. by @obi1kenobi in https://github.com/obi1kenobi/trustfall/pull/275
FilterTypeError
should display the inner error's message. by @obi1kenobi in https://github.com/obi1kenobi/trustfall/pull/278
trustfall_core
. by @obi1kenobi in https://github.com/obi1kenobi/trustfall/pull/284
Arc
of adapter to execute queries. by @obi1kenobi in https://github.com/obi1kenobi/trustfall/pull/286
Arc
-based query execution. by @obi1kenobi in https://github.com/obi1kenobi/trustfall/pull/295
Full Changelog: https://github.com/obi1kenobi/trustfall/compare/trustfall-v0.4.0...trustfall-v0.5.0
Published by obi1kenobi over 1 year ago
Adapter
trait methods now take &self
instead of &mut self
to avoid reentrancy bugs: #249Adapter
methods now take a resolve_info
argument that can be used to get information about the query for the purpose of applying optimizations. In cargo-semver-checks
this new API led to a 2354x speedup.Replace all BasicAdapter
and Adapter
method receivers with &self
instead of &mut self
.
If you need mutability, you need to do BOTH of these things:
ContextIterator
input iterator before doing any mutation, to avoid reentrancy bugsRefCell
around your Adapter
or BasicAdapter
's mutable state, making sure to not hold its mutable borrow across operations on the input ContextIterator
in order to avoid reentrancy bugsVertexInfo
notable trait and basic hint functionality. by @obi1kenobi in https://github.com/obi1kenobi/trustfall/pull/219
edges_with_name
doc comment. by @obi1kenobi in https://github.com/obi1kenobi/trustfall/pull/223
*_property
helper macros without importing FieldValue
by @ginger51011 in https://github.com/obi1kenobi/trustfall/pull/229
statically_known_property()
on VertexInfo
. by @obi1kenobi in https://github.com/obi1kenobi/trustfall/pull/228
EdgeInfo
in trustfall
. by @obi1kenobi in https://github.com/obi1kenobi/trustfall/pull/235
'vertex
lifetime. by @obi1kenobi in https://github.com/obi1kenobi/trustfall/pull/237
trustfall/examples
and to the weather
demo. by @obi1kenobi in https://github.com/obi1kenobi/trustfall/pull/239
Adapter
trait methods take &self
instead of &mut self
. by @obi1kenobi in https://github.com/obi1kenobi/trustfall/pull/249
&self
-based Adapter
API. by @obi1kenobi in https://github.com/obi1kenobi/trustfall/pull/250
@optional
+ @filter
. by @obi1kenobi in https://github.com/obi1kenobi/trustfall/pull/252
@optional
semantics. by @obi1kenobi in https://github.com/obi1kenobi/trustfall/pull/253
@optional
edge should disable many hints. by @obi1kenobi in https://github.com/obi1kenobi/trustfall/pull/254
@tag
from nonexistent @optional
inside @fold
works now. by @obi1kenobi in https://github.com/obi1kenobi/trustfall/pull/257
@tag
on @fold
-related field inside nonexistent @optional
. by @obi1kenobi in https://github.com/obi1kenobi/trustfall/pull/258
cloned()
methods on Range
and CandidateValue
. by @obi1kenobi in https://github.com/obi1kenobi/trustfall/pull/262
FieldValue::as_vec()
to as_vec_with()
. by @obi1kenobi in https://github.com/obi1kenobi/trustfall/pull/263
VertexInfo
trait. by @obi1kenobi in https://github.com/obi1kenobi/trustfall/pull/267
trustfall
docs on docs.rs with the --cfg docsrs
flag. by @obi1kenobi in https://github.com/obi1kenobi/trustfall/pull/269
Full Changelog: https://github.com/obi1kenobi/trustfall/compare/trustfall-v0.3.4...trustfall-v0.4.0
Published by github-actions[bot] over 2 years ago
Published by github-actions[bot] over 2 years ago
Published by github-actions[bot] over 2 years ago
Full Changelog: https://github.com/obi1kenobi/trustfall/compare/pytrustfall-v0.1.0-452037d...trustfall_wasm-v0.1.0-844543d
Published by github-actions[bot] over 2 years ago
Full Changelog: https://github.com/obi1kenobi/trustfall/compare/pytrustfall-v0.1.0-452037d...pytrustfall-v0.1.0-844543d
Published by github-actions[bot] over 2 years ago
Full Changelog: https://github.com/obi1kenobi/trustfall/compare/trustfall_wasm-v0.1.0-68cf4d5...trustfall_wasm-v0.1.0-452037d
Published by github-actions[bot] over 2 years ago
Full Changelog: https://github.com/obi1kenobi/trustfall/compare/trustfall_wasm-v0.1.0-68cf4d5...pytrustfall-v0.1.0-452037d
Published by github-actions[bot] over 2 years ago
Published by github-actions[bot] over 2 years ago
Published by github-actions[bot] over 2 years ago
Published by github-actions[bot] over 2 years ago
Full Changelog: https://github.com/obi1kenobi/trustfall/compare/pytrustfall-v0.1.0-f7239ba...trustfall_wasm-v0.1.0-86b74b8
Published by github-actions[bot] over 2 years ago
Full Changelog: https://github.com/obi1kenobi/trustfall/compare/pytrustfall-v0.1.0-f7239ba...pytrustfall-v0.1.0-86b74b8
Published by github-actions[bot] over 2 years ago