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

Function NewSchemaLoader

pkg/schema/loader.go:28–36  ·  view source on GitHub ↗

End Loader struct NewSchemaLoader initializes and returns a new Loader instance. It sets up the map of loader functions for each Type.

()

Source from the content-addressed store, hash-verified

26// NewSchemaLoader initializes and returns a new Loader instance.
27// It sets up the map of loader functions for each Type.
28func NewSchemaLoader() *Loader {
29 return &Loader{
30 loaders: map[Type]func(string) (string, error){ // Initialize loaders
31 URL: loadFromURL, // URL loader function
32 File: loadFromFile, // File loader function
33 Inline: loadInline, // Inline loader function
34 }, // End loaders map
35 } // End return
36} // End NewSchemaLoader
37// LoadSchema loads a schema based on its type
38func (s *Loader) LoadSchema(input string) (string, error) {
39 schemaType, err := determineSchemaType(input)

Callers 3

coverageFunction · 0.92
validateFunction · 0.92
loader_test.goFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected