organize + graph

This commit is contained in:
mr
2024-07-18 11:51:12 +02:00
parent 2eb74da9d2
commit 29a75bced9
69 changed files with 952 additions and 1531 deletions

22
dbs/dbs.go Normal file
View File

@@ -0,0 +1,22 @@
package dbs
import (
"go.mongodb.org/mongo-driver/bson"
)
type Input = map[string]interface{}
func InputToBson(i Input, isUpdate bool) bson.D {
input := bson.D{}
for k, v := range i {
if k == "id" {
input = append(input, bson.E{Key: "_id", Value: v})
} else {
input = append(input, bson.E{Key: k, Value: v})
}
}
if isUpdate {
return bson.D{{Key: "$set", Value: input}}
}
return input
}