Skip to content

Commit

Permalink
Add logEntity function (#405)
Browse files Browse the repository at this point in the history
Signed-off-by: Anton Rusev <anton.rusev@limechain.tech>
  • Loading branch information
arrusev authored Sep 11, 2023
1 parent 10cff53 commit 9e48102
Show file tree
Hide file tree
Showing 5 changed files with 185 additions and 118 deletions.
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ run_script = "0.9"
regex = "1.5.4"
serde_yaml = "0.8.21"
graphql-parser = "0.4.0"
serde = "1.0.139"

[dev-dependencies]
serial_test = "0.5.1"
15 changes: 7 additions & 8 deletions src/context/derived_schema.rs
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
use std::collections::HashMap;

use graph::data::graphql::ext::DirectiveFinder;
use graph_graphql::graphql_parser::schema;

use crate::context::{MatchstickInstanceContext, SCHEMA};
use crate::context::MatchstickInstanceContext;

pub(crate) fn derive_schema<C: graph::blockchain::Blockchain>(
context: &mut MatchstickInstanceContext<C>,
) {
SCHEMA.definitions.iter().for_each(|def| {
if let schema::Definition::TypeDefinition(schema::TypeDefinition::Object(o)) = def {
let entity_type = &o.name;
let derived_fields = o.fields.iter().filter(|&f| f.is_derived());
context
.schema
.iter()
.for_each(|(entity_type, entity_object)| {
let derived_fields = entity_object.fields.iter().filter(|&f| f.is_derived());
for virtual_field in derived_fields {
// field type is received as: '[ExampleClass!]!' and needs to be reduced to a class string
let derived_from_entity_type = virtual_field
Expand Down Expand Up @@ -49,6 +49,5 @@ pub(crate) fn derive_schema<C: graph::blockchain::Blockchain>(
.insert(entity_type.to_string(), entity_virtual_fields);
}
}
}
});
});
}
Loading

0 comments on commit 9e48102

Please sign in to comment.