Skip to content

Commit

Permalink
Fix/remove mongo embed index (#323)
Browse files Browse the repository at this point in the history
* cmd: cut v2.8.3

* cmd: cut v2.8.4

* ci: deprecate --rm-dist

* main: remove replace rule

* cmd: cut v2.8.5

* tpl: remove embed mongo postHook IndexFunc if flags or sort is set
  • Loading branch information
scbizu authored Nov 5, 2024
1 parent 63bedad commit 3cd9737
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 10 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/go-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
with:
distribution: goreleaser
version: latest
args: release --rm-dist
args: release --clean
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
-
Expand Down
2 changes: 1 addition & 1 deletion cmd/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ func version(commit string) string {
const (
vMajor = 2
vMinor = 8
vPatch = 2
vPatch = 5
)

// versionCmd represents the version command
Expand Down
12 changes: 7 additions & 5 deletions e2e/mongo/nested/gen_Blog_struct.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,16 @@ import (
var _ time.Time

type Blog struct {
ID primitive.ObjectID `json:"id" bson:"_id,omitempty"`
BlogId uint64 `bson:"bid" json:"bid"`
isNew bool
ID primitive.ObjectID `json:"id" bson:"_id,omitempty"`
BlogId uint64 `bson:"bid" json:"bid"`
BlogTitle string `bson:"BlogTitle" json:"BlogTitle"`
isNew bool
}

const (
BlogMgoFieldID = "_id"
BlogMgoFieldBlogId = "bid"
BlogMgoFieldID = "_id"
BlogMgoFieldBlogId = "bid"
BlogMgoFieldBlogTitle = "BlogTitle"
)

// BlogMgoSortField_WRP is a wrapper of Blog sort fields e.g.:
Expand Down
2 changes: 2 additions & 0 deletions e2e/mongo/nested/nested.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,5 @@ Blog:
fields:
- BlogId: uint64
attrs: {bsonTag: "bid", jsonTag: "bid"}
- BlogTitle: string
flags: [index]
4 changes: 1 addition & 3 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ go 1.21

require (
github.com/DATA-DOG/go-sqlmock v1.5.0
github.com/ezbuy/ezorm/v2/pkg v0.0.10
github.com/ezbuy/ezorm/v2/pkg v0.0.14
github.com/ezbuy/utils v0.0.0-20170609090716-8ac4beef008f
github.com/ezbuy/wrapper v1.0.3
github.com/iancoleman/strcase v0.2.0
Expand Down Expand Up @@ -94,5 +94,3 @@ require (
gopkg.in/natefinch/lumberjack.v2 v2.0.0 // indirect
sourcegraph.com/sourcegraph/appdash v0.0.0-20190731080439-ebfcffb1b5c0 // indirect
)

replace github.com/ezbuy/ezorm/v2/pkg => ./v2/pkg
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,8 @@ github.com/envoyproxy/go-control-plane v0.9.9-0.20210217033140-668b12f5399d/go.m
github.com/envoyproxy/go-control-plane v0.9.9-0.20210512163311-63b5d3c536b0/go.mod h1:hliV/p42l8fGbc6Y9bQ70uLwIvmJyVE5k4iMKlh8wCQ=
github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c=
github.com/erikstmartin/go-testdb v0.0.0-20160219214506-8d10e4a1bae5/go.mod h1:a2zkGnVExMxdzMo3M0Hi/3sEU+cWnZpSni0O6/Yb/P0=
github.com/ezbuy/ezorm/v2/pkg v0.0.14 h1:O9Y3t2jMYECENNEjRTCDCDLIppfBw238cIsFflhaZ1M=
github.com/ezbuy/ezorm/v2/pkg v0.0.14/go.mod h1:SPhoL0hpPET4mSHoSOTa96OuS4UoZOWxDwKu7kmZxok=
github.com/ezbuy/statsd v0.0.0-20190521031639-ae237584062d h1:SeHyPo+ykKm5DKcBUDEqTW5FNDS2kIBx6iFie3OttPw=
github.com/ezbuy/statsd v0.0.0-20190521031639-ae237584062d/go.mod h1:RUr3GtpMTjto7ygeUCLHDs6uBzvV5aHSzGUbr8YZkJU=
github.com/ezbuy/utils v0.0.0-20170609090716-8ac4beef008f h1:f6mjy3cXO0yeEROA2hs94Gj3iOpQExCZt0bP9O4dW98=
Expand Down
2 changes: 2 additions & 0 deletions internal/parser/shared/tpl/mongo_config.gogo
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,11 @@ func MgoSetup(config *db.MongoConfig, opts ...SetupOptionFn) {
// setup the indexes
sopt.postHooks = append(sopt.postHooks,
{{- range $index, $obj := .}}
{{- if not $obj.IsEmbed}}
{{- if gt (len $obj.Indexes) 0}}
{{$obj.Name}}IndexesFunc,
{{- end}}
{{- end}}
{{- end}}
)
var dopt []db.MongoDriverConnOptionFn
Expand Down

0 comments on commit 3cd9737

Please sign in to comment.