Properly check for discriminator field in context
This commit is contained in:
7
go.mod
7
go.mod
@@ -3,8 +3,8 @@ module git.gsuntres.com/general/persist
|
||||
go 1.25.0
|
||||
|
||||
require (
|
||||
git.gsuntres.com/general/commons v0.0.0-20260422140002-55de9c34e8c1
|
||||
git.gsuntres.com/general/mongo v0.0.0-20260422142328-49a1d24660aa
|
||||
git.gsuntres.com/general/commons v0.0.0-20260423171748-0ce3f3b5eb8c
|
||||
git.gsuntres.com/general/mongo v0.0.0-20260423171920-f0c0c55e89f3
|
||||
git.gsuntres.com/general/structful v0.0.0-20260415004657-80b95298f342
|
||||
github.com/go-viper/mapstructure/v2 v2.5.0
|
||||
github.com/testcontainers/testcontainers-go v0.41.0
|
||||
@@ -15,6 +15,7 @@ require (
|
||||
|
||||
require (
|
||||
dario.cat/mergo v1.0.2 // indirect
|
||||
git.gsuntres.com/general/events v0.0.0-20260423140000-1435849fb2c0 // indirect
|
||||
git.gsuntres.com/general/sys v0.0.1 // indirect
|
||||
github.com/Azure/go-ansiterm v0.0.0-20250102033503-faa5f7b0171c // indirect
|
||||
github.com/Microsoft/go-winio v0.6.2 // indirect
|
||||
@@ -79,3 +80,5 @@ require (
|
||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20260311181403-84a4fc48630c // indirect
|
||||
gopkg.in/yaml.v3 v3.0.1 // indirect
|
||||
)
|
||||
|
||||
replace git.gsuntres.com/general/events => /home/master/Workspace/_general/events
|
||||
|
||||
4
go.sum
4
go.sum
@@ -2,8 +2,12 @@ dario.cat/mergo v1.0.2 h1:85+piFYR1tMbRrLcDwR18y4UKJ3aH1Tbzi24VRW1TK8=
|
||||
dario.cat/mergo v1.0.2/go.mod h1:E/hbnu0NxMFBjpMIE34DRGLWqDy0g5FuKDhCb31ngxA=
|
||||
git.gsuntres.com/general/commons v0.0.0-20260422140002-55de9c34e8c1 h1:g96tzABUPqaAaftDBLbDkf/za21kBAUiex8LU//NsFE=
|
||||
git.gsuntres.com/general/commons v0.0.0-20260422140002-55de9c34e8c1/go.mod h1:s774W5vN/53DLYKeY4iwFnwPOIHfSg8/V6Ft7sEdl9M=
|
||||
git.gsuntres.com/general/commons v0.0.0-20260423171748-0ce3f3b5eb8c h1:YZJWYDqqUC0x687yYrcCYzMIvSO40H25IsInBCl+g6A=
|
||||
git.gsuntres.com/general/commons v0.0.0-20260423171748-0ce3f3b5eb8c/go.mod h1:S93xcBczrgN+gZU0JWkPRnTcAMvQuTp1ChyKkOd/I50=
|
||||
git.gsuntres.com/general/mongo v0.0.0-20260422142328-49a1d24660aa h1:Um0LsIApTZlVtXif+DYqyd28pjfzK4ObGScksqJFeZk=
|
||||
git.gsuntres.com/general/mongo v0.0.0-20260422142328-49a1d24660aa/go.mod h1:N1OVqb4osp/dlH+nvtTqe5rZK367Dqx6oprJT9xLpac=
|
||||
git.gsuntres.com/general/mongo v0.0.0-20260423171920-f0c0c55e89f3 h1:XP3orDP9QDbD/MXc/uWYu8CM79qHzVmthFW/M+CymHs=
|
||||
git.gsuntres.com/general/mongo v0.0.0-20260423171920-f0c0c55e89f3/go.mod h1:ci07ETyg2Y7zsjS3neGpVJcH9svCAkntN6E9LeLCq5M=
|
||||
git.gsuntres.com/general/structful v0.0.0-20260415004657-80b95298f342 h1:atJ49utlrKue+mu+lbw18bvhG30TnTXQYokTKrH80+4=
|
||||
git.gsuntres.com/general/structful v0.0.0-20260415004657-80b95298f342/go.mod h1:QILJDJKzi75Q4av6LvI+/OwXAeqoLtx6p5UZXqlxfKc=
|
||||
git.gsuntres.com/general/sys v0.0.1 h1:JpGG6HCkJrTaCICR09kURhMTIc+/s8yb0lHQjo/TDVI=
|
||||
|
||||
@@ -17,7 +17,7 @@ import (
|
||||
)
|
||||
|
||||
type PersistProps struct {
|
||||
MongoSysDb string
|
||||
MongoSysDb string
|
||||
}
|
||||
|
||||
// Persist is the root object for accessing data.
|
||||
@@ -36,7 +36,7 @@ func NewPersist(props *PersistProps) *Persist {
|
||||
}
|
||||
|
||||
p.SysDb = props.MongoSysDb
|
||||
|
||||
|
||||
return p
|
||||
}
|
||||
|
||||
|
||||
@@ -49,7 +49,11 @@ func BuildInsertOne(col map[string]any, report *InitReport) {
|
||||
if isSystem {
|
||||
db = sysDb
|
||||
} else {
|
||||
account := ctx.Value("account").(string)
|
||||
accountAny := ctx.Value("account")
|
||||
if accountAny == nil {
|
||||
return nil, fmt.Errorf("account required for %s", name)
|
||||
}
|
||||
account := accountAny.(string)
|
||||
if account != "" {
|
||||
db = mc.GetName(account)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user