mirror of
https://github.com/garraflavatra/rolens.git
synced 2025-01-18 13:07:58 +00:00
Use BSON instead of JSON for unmarshalling
This commit is contained in:
parent
fa924f087d
commit
b58a2ca84f
@ -47,7 +47,7 @@ func (a *App) FindItems(hostKey, dbKey, collKey string, formJson string) findRes
|
||||
var projection bson.M
|
||||
var sort bson.M
|
||||
|
||||
err = json.Unmarshal([]byte(form.Query), &query)
|
||||
err = bson.UnmarshalExtJSON([]byte(form.Query), true, &query)
|
||||
if err != nil {
|
||||
fmt.Println(err.Error())
|
||||
runtime.MessageDialog(a.ctx, runtime.MessageDialogOptions{
|
||||
|
@ -1,11 +1,11 @@
|
||||
package app
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
"github.com/wailsapp/wails/v2/pkg/runtime"
|
||||
"go.mongodb.org/mongo-driver/bson"
|
||||
)
|
||||
|
||||
func (a *App) InsertItems(hostKey, dbKey, collKey, jsonData string) interface{} {
|
||||
@ -16,7 +16,7 @@ func (a *App) InsertItems(hostKey, dbKey, collKey, jsonData string) interface{}
|
||||
jsonData = "[" + jsonData + "]"
|
||||
}
|
||||
|
||||
err := json.Unmarshal([]byte(jsonData), &data)
|
||||
err := bson.UnmarshalExtJSON([]byte(jsonData), true, &data)
|
||||
if err != nil {
|
||||
fmt.Println(err.Error())
|
||||
runtime.MessageDialog(a.ctx, runtime.MessageDialogOptions{
|
||||
|
@ -1,7 +1,6 @@
|
||||
package app
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
@ -27,7 +26,7 @@ func (a *App) RemoveItems(hostKey, dbKey, collKey, jsonData string, many bool) i
|
||||
return 0
|
||||
}
|
||||
} else {
|
||||
err = json.Unmarshal([]byte(jsonData), &filter)
|
||||
err = bson.UnmarshalExtJSON([]byte(jsonData), true, &filter)
|
||||
if err != nil {
|
||||
fmt.Println(err.Error())
|
||||
runtime.MessageDialog(a.ctx, runtime.MessageDialogOptions{
|
||||
|
@ -43,7 +43,7 @@ func (a *App) UpdateItems(hostKey, dbKey, collKey string, formJson string) int64
|
||||
var query bson.M
|
||||
update := bson.M{}
|
||||
|
||||
err = json.Unmarshal([]byte(form.Query), &query)
|
||||
err = bson.UnmarshalExtJSON([]byte(form.Query), true, &query)
|
||||
if err != nil {
|
||||
fmt.Println(err.Error())
|
||||
runtime.MessageDialog(a.ctx, runtime.MessageDialogOptions{
|
||||
|
Loading…
Reference in New Issue
Block a user