End Loader struct NewSchemaLoader initializes and returns a new Loader instance. It sets up the map of loader functions for each Type.
()
| 26 | // NewSchemaLoader initializes and returns a new Loader instance. |
| 27 | // It sets up the map of loader functions for each Type. |
| 28 | func 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 |
| 38 | func (s *Loader) LoadSchema(input string) (string, error) { |
| 39 | schemaType, err := determineSchemaType(input) |
no outgoing calls
no test coverage detected