MCPcopy Create free account
hub / github.com/SeaQL/sea-orm / schema

Function schema

examples/react_admin/backend/src/graphql/query_root.rs:7–25  ·  view source on GitHub ↗
(
    database: DatabaseConnection,
    depth: usize,
    complexity: usize,
)

Source from the content-addressed store, hash-verified

5lazy_static::lazy_static! { static ref CONTEXT: BuilderContext = BuilderContext::default(); }
6
7pub fn schema(
8 database: DatabaseConnection,
9 depth: usize,
10 complexity: usize,
11) -> Result<Schema, SchemaError> {
12 // Builder of Seaography query root
13 let builder = Builder::new(&CONTEXT, database.clone());
14 // Register SeaORM entities
15 let builder = crate::models::_entities::register_entity_modules(builder);
16 // Configure async GraphQL limits
17 let schema = builder
18 .schema_builder()
19 // The depth is the number of nesting levels of the field
20 .limit_depth(depth)
21 // The complexity is the number of fields in the query
22 .limit_complexity(complexity);
23 // Finish up with including SeaORM database connection
24 schema.data(database).finish()
25}

Callers 1

graphql_handlerFunction · 0.50

Calls 1

newFunction · 0.50

Tested by

no test coverage detected