reactive_graph_graphql_schema/query/
mod.rs

1use async_graphql::Context;
2use async_graphql::Object;
3use uuid::Uuid;
4
5pub use behaviours::*;
6pub use instances::*;
7pub use json_schema::*;
8pub use types::*;
9
10pub mod behaviours;
11pub mod instances;
12pub mod json_schema;
13pub mod types;
14
15pub struct ReactiveGraphQuery;
16
17/// Search queries for the type system, the instances and the flows.
18#[Object(name = "Query")]
19impl ReactiveGraphQuery {
20    /// Search for types (components, entity types, relation types).
21    async fn types(&self) -> Types {
22        Types
23    }
24
25    /// Search for instances (entity instances, relation instances).
26    async fn instances(&self) -> Instances {
27        Instances
28    }
29
30    /// Search for behaviours (entity behaviours, entity component behaviours, relation behaviours,
31    /// relation component behaviours).
32    async fn behaviours(&self) -> Behaviours {
33        Behaviours
34    }
35
36    /// JSON Schema definitions.
37    async fn json_schema(&self) -> JsonSchema {
38        JsonSchema
39    }
40
41    async fn random_uuid(&self, _context: &Context<'_>) -> String {
42        Uuid::new_v4().to_string()
43    }
44}