From 5285b6132095f2fee05fbad7478f370ff05325d5 Mon Sep 17 00:00:00 2001 From: Celestino Amoroso Date: Sat, 9 May 2026 10:34:46 +0200 Subject: [PATCH] 'join' operator renamed as 'cat' --- operator-join.go => operator-cat.go | 12 ++++++------ scan/symbol.go | 2 ++ t_operator_test.go | 8 ++++---- 3 files changed, 12 insertions(+), 10 deletions(-) rename operator-join.go => operator-cat.go (84%) diff --git a/operator-join.go b/operator-cat.go similarity index 84% rename from operator-join.go rename to operator-cat.go index 3765e12..25ea85a 100644 --- a/operator-join.go +++ b/operator-cat.go @@ -1,7 +1,7 @@ // Copyright (c) 2024-2026 Celestino Amoroso (celestino.amoroso@gmail.com). // All rights reserved. -// operator-join.go +// operator-cat.go package expr import ( @@ -12,19 +12,19 @@ import ( "git.portale-stac.it/go-pkg/expr/scan" ) -//-------- join term +//-------- cat term -func newJoinTerm(tk *scan.Token) (inst *scan.Term) { +func newCatTerm(tk *scan.Token) (inst *scan.Term) { return &scan.Term{ Tk: *tk, Children: make([]*scan.Term, 0, 2), Position: scan.PosInfix, Priority: scan.PriIterOp, - EvalFunc: evalJoin, + EvalFunc: evalCat, } } -func evalJoin(ctx kern.ExprContext, opTerm *scan.Term) (v any, err error) { +func evalCat(ctx kern.ExprContext, opTerm *scan.Term) (v any, err error) { var leftValue, rightValue any var itLeft, itRight kern.Iterator var item any @@ -69,5 +69,5 @@ func evalJoin(ctx kern.ExprContext, opTerm *scan.Term) (v any, err error) { // init func init() { - scan.RegisterTermConstructor(scan.SymKwJoin, newJoinTerm) + scan.RegisterTermConstructor(scan.SymKwCat, newCatTerm) } diff --git a/scan/symbol.go b/scan/symbol.go index 34056dc..ee45309 100644 --- a/scan/symbol.go +++ b/scan/symbol.go @@ -122,6 +122,7 @@ const ( SymKwMap SymKwFilter SymKwDigest + SymKwCat SymKwGroupBy SymKwJoin SymKwNil @@ -141,6 +142,7 @@ func init() { "IN": SymKwIn, "INCLUDE": SymKwInclude, "MAP": SymKwMap, + "CAT": SymKwCat, "FILTER": SymKwFilter, "NOT": SymKwNot, "OR": SymKwOr, diff --git a/t_operator_test.go b/t_operator_test.go index 1edcd3d..e83bb4c 100644 --- a/t_operator_test.go +++ b/t_operator_test.go @@ -75,11 +75,11 @@ func TestOperatorDigest(t *testing.T) { runTestSuite(t, section, inputs) } -func TestOperatorJoin(t *testing.T) { - section := "Operator-Join" +func TestOperatorCat(t *testing.T) { + section := "Operator-Cat" inputs := []inputType{ - /* 1 */ {`["a","b"] join ["x"]`, kern.NewList([]any{"a", "b", "x"}), nil}, - /* 2 */ {`["a","b"] join ["x"-true]`, nil, `[1:21] left operand 'x' [string] and right operand 'true' [bool] are not compatible with operator "-"`}, + /* 1 */ {`["a","b"] cat ["x"]`, kern.NewList([]any{"a", "b", "x"}), nil}, + /* 2 */ {`["a","b"] cat ["x"-true]`, nil, `[1:20] left operand 'x' [string] and right operand 'true' [bool] are not compatible with operator "-"`}, } // runTestSuiteSpec(t, section, inputs, 2)