MCPcopy Create free account
hub / github.com/Permify/permify / NewSchemaFromStringDefinitions

Function NewSchemaFromStringDefinitions

internal/schema/schema.go:16–25  ·  view source on GitHub ↗

NewSchemaFromStringDefinitions creates a new `SchemaDefinition` from a list of string definitions. The `validation` argument determines whether to validate the input definitions before creating the schema. If the validation is successful, it returns a pointer to the newly created `SchemaDefinition`.

(validation bool, definitions ...string)

Source from the content-addressed store, hash-verified

14// If the validation is successful, it returns a pointer to the newly created `SchemaDefinition`.
15// If there's an error during validation or creating the schema, it returns an error.
16func NewSchemaFromStringDefinitions(validation bool, definitions ...string) (*base.SchemaDefinition, error) {
17 // Create entity definitions from the input string definitions
18 en, ru, err := NewEntityAndRuleDefinitionsFromStringDefinitions(validation, definitions...)
19 if err != nil {
20 // If there's an error, return the error
21 return nil, err
22 }
23 // Create a schema from the entity definitions
24 return NewSchemaFromEntityAndRuleDefinitions(en, ru), nil
25}
26
27// NewSchemaFromEntityAndRuleDefinitions creates a new base.SchemaDefinition from entity and rule definitions.
28// It takes two slices of pointers to base.EntityDefinition and base.RuleDefinition, representing the entities and rules to include in the schema.

Callers 9

runGenerateAstFunction · 0.92
ReadSchemaMethod · 0.92
ReadEntityDefinitionMethod · 0.92
ReadRuleDefinitionMethod · 0.92
ReadSchemaMethod · 0.92
ReadEntityDefinitionMethod · 0.92
ReadRuleDefinitionMethod · 0.92
utils_test.goFile · 0.92
schema_test.goFile · 0.85

Tested by

no test coverage detected