Compare commits
2 Commits
Author | SHA1 | Date | |
---|---|---|---|
c7df9d2264
|
|||
d0954bf133
|
@@ -55,12 +55,13 @@ func GenerateEnumSpecs(sourceDir string, destFile string) error {
|
||||
}
|
||||
}
|
||||
|
||||
langext.ArrFilter(files, func(v os.DirEntry) bool { return v.Name() != path.Base(destFile) })
|
||||
files = langext.ArrFilter(files, func(v os.DirEntry) bool { return v.Name() != path.Base(destFile) })
|
||||
files = langext.ArrFilter(files, func(v os.DirEntry) bool { return strings.HasSuffix(v.Name(), ".go") })
|
||||
langext.SortBy(files, func(v os.DirEntry) string { return v.Name() })
|
||||
|
||||
newChecksumStr := goext.GoextVersion
|
||||
for _, f := range files {
|
||||
content, err := os.ReadFile(destFile)
|
||||
content, err := os.ReadFile(path.Join(sourceDir, f.Name()))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -81,15 +82,8 @@ func GenerateEnumSpecs(sourceDir string, destFile string) error {
|
||||
pkgname := ""
|
||||
|
||||
for _, f := range files {
|
||||
if !strings.HasSuffix(f.Name(), ".go") {
|
||||
continue
|
||||
}
|
||||
if f.Name() == path.Base(destFile) {
|
||||
continue
|
||||
}
|
||||
|
||||
fmt.Printf("========= %s =========\n\n", f.Name())
|
||||
fileEnums, pn, err := processFile(f.Name())
|
||||
fileEnums, pn, err := processFile(path.Join(sourceDir, f.Name()))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
15
bfcodegen/enum-generate_test.go
Normal file
15
bfcodegen/enum-generate_test.go
Normal file
@@ -0,0 +1,15 @@
|
||||
package bfcodegen
|
||||
|
||||
import (
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestApplyEnvOverridesSimple(t *testing.T) {
|
||||
|
||||
err := GenerateEnumSpecs("/home/mike/Code/reiff/badennet/bnet-backend/models", "/home/mike/Code/reiff/badennet/bnet-backend/models/enums_gen.go")
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
t.Fail()
|
||||
}
|
||||
|
||||
}
|
@@ -1,5 +1,5 @@
|
||||
package goext
|
||||
|
||||
const GoextVersion = "0.0.144"
|
||||
const GoextVersion = "0.0.146"
|
||||
|
||||
const GoextVersionTimestamp = "2023-06-07T12:39:21+0200"
|
||||
const GoextVersionTimestamp = "2023-06-07T12:59:15+0200"
|
||||
|
@@ -57,7 +57,20 @@ func CreatePagination[TData any](coll *Coll[TData], token ct.CursorToken, fieldP
|
||||
|
||||
pipeline := make([]bson.D, 0, 3)
|
||||
|
||||
pipeline = append(pipeline, bson.D{{Key: "$match", Value: bson.M{"$or": cond}}})
|
||||
if token.Mode == ct.CTMStart {
|
||||
|
||||
// no gt/lt condition
|
||||
|
||||
} else if token.Mode == ct.CTMNormal {
|
||||
|
||||
pipeline = append(pipeline, bson.D{{Key: "$match", Value: bson.M{"$or": cond}}})
|
||||
|
||||
} else if token.Mode == ct.CTMEnd {
|
||||
|
||||
// false
|
||||
pipeline = append(pipeline, bson.D{{Key: "$match", Value: bson.M{"$eq": bson.A{"1", "0"}}}})
|
||||
|
||||
}
|
||||
|
||||
pipeline = append(pipeline, bson.D{{Key: "$sort", Value: sort}})
|
||||
|
||||
|
Reference in New Issue
Block a user