MCPcopy Create free account
hub / github.com/cloudwan/gohan / LoadResource

Method LoadResource

schema/manager.go:268–276  ·  view source on GitHub ↗

LoadResource makes resource from datamap

(schemaID string, dataMap map[string]interface{})

Source from the content-addressed store, hash-verified

266
267//LoadResource makes resource from datamap
268func (manager *Manager) LoadResource(schemaID string, dataMap map[string]interface{}) (*Resource, error) {
269 manager.mu.RLock()
270 defer manager.mu.RUnlock()
271
272 if schema, ok := manager.schema(schemaID); ok {
273 return NewResource(schema, dataMap)
274 }
275 return nil, fmt.Errorf("Schema Not Found: %s", schemaID)
276}
277
278//LoadResourceFromJSONString makes resource from jsonString
279func (manager *Manager) LoadResourceFromJSONString(schemaID string, jsonData string) (*Resource, error) {

Callers 15

CreateResourceFunction · 0.80
db_test.goFile · 0.80
DBCreateFunction · 0.80
DBUpdateFunction · 0.80
schemas_test.goFile · 0.80
otto_test.goFile · 0.80

Calls 3

schemaMethod · 0.95
NewResourceFunction · 0.85
ErrorfMethod · 0.65

Tested by

no test coverage detected