mirror of
https://github.com/hasura/graphql-engine.git
synced 2024-12-14 08:02:15 +03:00
parent
1e20026ea2
commit
f147f6d6a6
@ -3,6 +3,8 @@ package hasuradb
|
||||
import (
|
||||
"encoding/json"
|
||||
"net/http"
|
||||
|
||||
"github.com/oliveagle/jsonpath"
|
||||
)
|
||||
|
||||
func (h *HasuraDB) ExportMetadata() (interface{}, error) {
|
||||
@ -118,6 +120,26 @@ func (h *HasuraDB) ApplyMetadata(data interface{}) error {
|
||||
h.logger.Debug(err)
|
||||
return err
|
||||
}
|
||||
|
||||
if horror.Path != "" {
|
||||
jsonData, err := json.Marshal(query)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
var metadataQuery interface{}
|
||||
err = json.Unmarshal(jsonData, &metadataQuery)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
lookup, err := jsonpath.JsonPathLookup(metadataQuery, horror.Path)
|
||||
if err == nil {
|
||||
queryData, err := json.MarshalIndent(lookup, "", " ")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
horror.migrationQuery = "offending object: \n\r\n\r" + string(queryData)
|
||||
}
|
||||
}
|
||||
return horror.Error(h.config.isCMD)
|
||||
}
|
||||
return nil
|
||||
|
Loading…
Reference in New Issue
Block a user