diff --git a/Version b/Version index 2007b61b..15c06c46 100644 --- a/Version +++ b/Version @@ -1 +1 @@ -0.77.1 \ No newline at end of file +0.77.2 \ No newline at end of file diff --git a/endly/build.yaml b/endly/build.yaml index 4150a898..3cd7069f 100644 --- a/endly/build.yaml +++ b/endly/build.yaml @@ -19,9 +19,6 @@ pipeline: - export GOARCH=amd64 - go build -ldflags="-X 'main.Version=${Ver}'" - tar cvzf endly_linux_${Ver}_amd64.tar.gz endly - - export GOOS=windows - - go build -ldflags="-X 'main.Version=${Ver}'" - - tar cvzf endly_windows_${Ver}_amd64.tar.gz endly - export GOOS=darwin - go build -ldflags="-X 'main.Version=${Ver}'" - tar cvzf endly_darwin_${Ver}_amd64.tar.gz endly @@ -29,3 +26,6 @@ pipeline: - export GOARCH=arm64 - go build -ldflags="-X 'main.Version=${Ver}'" - tar cvzf endly_darwin_${Ver}_arm64.tar.gz endly + - export GOOS=windows + - go build -ldflags="-X 'main.Version=${Ver}'" + - tar cvzf endly_windows_${Ver}_amd64.tar.gz endly diff --git a/endly/endly.go b/endly/endly.go index c4ac04ec..85ec4ddc 100644 --- a/endly/endly.go +++ b/endly/endly.go @@ -5,6 +5,5 @@ import ( ) func main() { - bootstrap.Bootstrap() } diff --git a/go.mod b/go.mod index 85968faa..7fcc72c6 100644 --- a/go.mod +++ b/go.mod @@ -53,8 +53,8 @@ require ( github.com/viant/bgc v0.9.0 github.com/viant/dsc v0.19.0 github.com/viant/dsunit v0.11.1-0.20240315154953-016b93c322c2 - github.com/viant/scy v0.12.0 - github.com/viant/toolbox v0.37.1-0.20240920190350-4edcb037fba9 + github.com/viant/scy v0.12.1 + github.com/viant/toolbox v0.37.1-0.20240920204202-12309d1bb97c github.com/yuin/gopher-lua v1.1.1 // indirect golang.org/x/crypto v0.26.0 // indirect golang.org/x/net v0.28.0 @@ -203,6 +203,7 @@ require ( google.golang.org/grpc v1.63.2 // indirect gopkg.in/inf.v0 v0.9.1 // indirect gopkg.in/src-d/go-billy.v4 v4.3.2 // indirect + gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 // indirect gopkg.in/warnings.v0 v0.1.2 // indirect gotest.tools/v3 v3.5.1 // indirect ) diff --git a/go.sum b/go.sum index 7acc216a..36ae5643 100644 --- a/go.sum +++ b/go.sum @@ -1330,8 +1330,8 @@ github.com/viant/parsly v0.3.3-0.20240717150634-e1afaedb691b h1:3q166tV28yFdbFV+ github.com/viant/parsly v0.3.3-0.20240717150634-e1afaedb691b/go.mod h1:85fneXJbErKMGhSQto3A5ElTQCwl3t74U9cSV0waBHw= github.com/viant/pgo v0.11.0 h1:PNuYVhwTfyrAHGBO6lxaMFuHP4NkjKV8ULecz3OWk8c= github.com/viant/pgo v0.11.0/go.mod h1:MFzHmkRFZlciugEgUvpl/3grK789PBSH4dUVSLOSo+Q= -github.com/viant/scy v0.12.0 h1:Fo0DHviM1LHjj2XmtgIERmeh+z4X66AUXnUCTswFXT4= -github.com/viant/scy v0.12.0/go.mod h1:Lz1VPlmjVi4ydZ5ikP/d5uQS/xYs22HG23++PgLRlKQ= +github.com/viant/scy v0.12.1 h1:kFtFXexMZrr41laAplKiKwuZo7KRikKgbXVvsXeYsTI= +github.com/viant/scy v0.12.1/go.mod h1:yHDc9YmfDqhxiMPZcCRS+rb9KUjMNZniWZ9LMQoM0KI= github.com/viant/sqlparser v0.7.4 h1:/jXiB2zC9cDXTwR0TgF2evrHC5oQPCAkkf0KZfe9Vks= github.com/viant/sqlparser v0.7.4/go.mod h1:2QRGiGZYk2/pjhORGG1zLVQ9JO+bXFhqIVi31mkCRPg= github.com/viant/sqlx v0.15.2-0.20240802175425-e8a939a4cf7b h1:tNkwnYy1K5ZYuElmaTP+L/SbJeq7qHbcVM5dglVPlt4= @@ -1346,6 +1346,8 @@ github.com/viant/toolbox v0.24.0/go.mod h1:OxMCG57V0PXuIP2HNQrtJf2CjqdmbrOx5EkMI github.com/viant/toolbox v0.34.5/go.mod h1:OxMCG57V0PXuIP2HNQrtJf2CjqdmbrOx5EkMILuUhzM= github.com/viant/toolbox v0.37.1-0.20240920190350-4edcb037fba9 h1:ZNZOh2Regsr8YO5ypilU47U7DIkoUKgIx6xofChgjRQ= github.com/viant/toolbox v0.37.1-0.20240920190350-4edcb037fba9/go.mod h1:OxMCG57V0PXuIP2HNQrtJf2CjqdmbrOx5EkMILuUhzM= +github.com/viant/toolbox v0.37.1-0.20240920204202-12309d1bb97c h1:/+EGnMFfdo2cHaFfK0rVf+RYxryMT3RAotLB37HinHs= +github.com/viant/toolbox v0.37.1-0.20240920204202-12309d1bb97c/go.mod h1:OxMCG57V0PXuIP2HNQrtJf2CjqdmbrOx5EkMILuUhzM= github.com/viant/velty v0.2.1-0.20230927172116-ba56497b5c85 h1:zKk+6hqUipkJXCPCHyFXzGtil1sfh80r6UZmloBNEDo= github.com/viant/velty v0.2.1-0.20230927172116-ba56497b5c85/go.mod h1:Q/UXviI2Nli8WROEpYd/BELMCSvnulQeyNrbPmMiS/Y= github.com/viant/x v0.3.0 h1:/3A0z/uySGxMo6ixH90VAcdjI00w5e3REC1zg5hzhJA= diff --git a/service/testing/dsunit/udf.go b/service/testing/dsunit/udf.go index 44002714..7bbdc2c6 100644 --- a/service/testing/dsunit/udf.go +++ b/service/testing/dsunit/udf.go @@ -136,6 +136,13 @@ func convertMultiTables(tables map[string]interface{}, state data.Map, prefix st for i, item := range tableDataSlice { itemMap := item.(map[string]interface{}) + caseTag := "" + caseTagValue, hasTag := itemMap["!tag"] + if hasTag { + caseTag = toolbox.AsString(caseTagValue) + delete(itemMap, "!tag") + } + sequencerValues := sequencerMapping.GetMap(sequencer) for k, v := range itemMap { if v == nil { @@ -144,21 +151,30 @@ func convertMultiTables(tables map[string]interface{}, state data.Map, prefix st if _, ok := v.([]string); ok { continue } - value := toolbox.AsString(v) - if strings.Contains(value, "$Data") || strings.Contains(value, "$uuid") { - itemMap[k] = sequencerMapping.Expand(strings.Replace(value, "/", ".", 1)) - } - - if strings.Contains(value, "$") { - expr, key := getSequencerExpr(value, sequencer) - seqValue, ok := sequencerValues[key] - if !ok { - seqValue, ok = sequencerValues.GetValue(key) + switch value := v.(type) { + case string: + if strings.Contains(value, "$Data") || strings.Contains(value, "$uuid") { + itemMap[k] = sequencerMapping.Expand(strings.Replace(value, "/", ".", 1)) + } else { + expanded, ok := expandSequenceExpr(value, toolbox.AsString(caseTag), sequencerMapping, sequencer, sequencerValues, state) + if ok { + itemMap[k] = expanded + } } - if ok { - itemMap[k] = strings.ReplaceAll(value, expr, toolbox.AsString(seqValue)) + case map[interface{}]interface{}: + for key, keyValue := range value { + stringKey, ok := key.(string) + if !ok { + continue + } + expanded, ok := expandSequenceExpr(stringKey, toolbox.AsString(caseTag), sequencerMapping, sequencer, sequencerValues, state) + if ok { + value[expanded] = keyValue + delete(value, key) + } } } + } tableDataSlice[i] = itemMap @@ -169,6 +185,32 @@ func convertMultiTables(tables map[string]interface{}, state data.Map, prefix st return result, nil } +func expandSequenceExpr(value, caseTag string, sequencerMapping data.Map, sequencer string, sequencerValues data.Map, state data.Map) (interface{}, bool) { + if caseTag != "" && strings.Contains(value, "${tag}") { + value = strings.Replace(value, "${tag}", toolbox.AsString(caseTag), 1) + } + + if strings.Contains(value, "$") { + expr, key := getSequencerExpr(value, sequencer) + seqValue, ok := sequencerValues[key] + if !ok { + seqValue, ok = sequencerValues.GetValue(key) + } + if !ok { + return value, false + } + value = strings.ReplaceAll(value, expr, toolbox.AsString(seqValue)) + if strings.Contains(value, "$") { + if strings.HasPrefix(value, "$AsInt") { + value = value[7 : len(value)-1] + } + value = state.ExpandAsText(value) + } + return value, true + } + return value, false +} + func getSequencerExpr(value string, sequencer string) (string, string) { expr := "$" + sequencer + "." index := strings.Index(value, expr) @@ -181,6 +223,12 @@ func getSequencerExpr(value string, sequencer string) (string, string) { } expr = value[index:] value = value[index+1+len(sequencer+"."):] + if idx := strings.Index(value, ")"); idx != -1 { + value = value[:idx] + if idx = strings.Index(expr, ")"); idx != -1 { + expr = expr[:idx] + } + } return expr, value }