Skip to content
Open
Show file tree
Hide file tree
Changes from 7 commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
8ff2b51
Added cdt_operation
mirzakaracic Oct 22, 2025
2e0311b
Working pathExpressions
mirzakaracic Oct 25, 2025
66f840f
Added cdt expressions
mirzakaracic Oct 30, 2025
eecfc62
Code clean up
mirzakaracic Oct 30, 2025
2efc7d2
Removed unused method that was added
mirzakaracic Oct 30, 2025
79f3244
Added Blob expression and checking for version of server
mirzakaracic Oct 30, 2025
c44b32e
Sever version check in exp_cdt_test.go
mirzakaracic Oct 30, 2025
6e06de4
Added ability to use preview builds in CI test and removed warning o…
mirzakaracic Nov 1, 2025
bd3ffc3
Fixed json
mirzakaracic Nov 1, 2025
9e3adf3
Fixed missing required parameter
mirzakaracic Nov 1, 2025
29404a3
Fixed json inputs
mirzakaracic Nov 1, 2025
85b41d3
Adding ability to provide templates and arbitrary number of secrets
mirzakaracic Nov 2, 2025
8940746
Json build fix
mirzakaracic Nov 2, 2025
7244783
Using test creds and adding debug step
mirzakaracic Nov 2, 2025
b5ea3dc
Fixed output
mirzakaracic Nov 2, 2025
1993c84
Removed composite action
mirzakaracic Nov 2, 2025
61adde5
More debug output
mirzakaracic Nov 2, 2025
1c968ef
Using heredoc
mirzakaracic Nov 2, 2025
d4a9556
More debug stuff
mirzakaracic Nov 2, 2025
6d70092
debug stuff
mirzakaracic Nov 2, 2025
4302eb0
added echo
mirzakaracic Nov 2, 2025
2fd72da
Using jq for json processing.
mirzakaracic Nov 3, 2025
7994346
Adding debug changes
mirzakaracic Nov 3, 2025
328cdd1
Adding more debug steps to make sure config is passed to follow up jobs
mirzakaracic Nov 3, 2025
5f81159
Removed deprecated parameter usage
mirzakaracic Nov 3, 2025
66d569f
Removed stup matrix job
mirzakaracic Nov 3, 2025
5dc871b
Alternative server matrix approach
mirzakaracic Nov 3, 2025
3d042fb
Made oidc integration global
mirzakaracic Nov 3, 2025
309c979
PR review comment changes and JFrog project change/fix
mirzakaracic Nov 3, 2025
78856e1
Updated audiance
mirzakaracic Nov 3, 2025
a88a39f
Moved permissions to action
mirzakaracic Nov 3, 2025
1424d95
Moved permissons to workflow
mirzakaracic Nov 3, 2025
8db94f1
Added ExpResultRemove
mirzakaracic Nov 4, 2025
d1f4e43
Working cdt_modify operation tests
mirzakaracic Nov 6, 2025
c954141
Updated tests working cdt_modify_remove
mirzakaracic Nov 7, 2025
264383b
Cleanup and final test fixes
mirzakaracic Nov 7, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
118 changes: 97 additions & 21 deletions cdt_context.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,22 +23,24 @@ import (
)

const (
ctxTypeListIndex = 0x10
ctxTypeListRank = 0x11
ctxTypeListValue = 0x13
ctxTypeMapIndex = 0x20
ctxTypeMapRank = 0x21
ctxTypeMapKey = 0x22
ctxTypeMapValue = 0x23
ctxTypeExpression = 0x04 // Expression-based context
ctxTypeListIndex = 0x10
ctxTypeListRank = 0x11
ctxTypeListValue = 0x13
ctxTypeMapIndex = 0x20
ctxTypeMapRank = 0x21
ctxTypeMapKey = 0x22
ctxTypeMapValue = 0x23
)

// CDTContext defines Nested CDT context. Identifies the location of nested list/map to apply the operation.
// for the current level.
// An array of CTX identifies location of the list/map on multiple
// levels on nesting.
type CDTContext struct {
Id int
Value Value
Id int
Value Value
Expression *Expression
}

// CDTContextToBase64 converts a []*CDTContext into a base64 encoded string.
Expand Down Expand Up @@ -78,7 +80,12 @@ func Base64ToCDTContext(b64 string) ([]*CDTContext, Error) {

res := make([]*CDTContext, 0, len(list)/2)
for i := 0; i < len(list); i += 2 {
res = append(res, &CDTContext{Id: list[i].(int), Value: NewValue(list[i+1])})
id := list[i].(int)
if id == ctxTypeExpression {
res = append(res, &CDTContext{Id: id, Expression: NewExpression(list[i+1])})
} else {
res = append(res, &CDTContext{Id: id, Value: NewValue(list[i+1])})
}
}

return res, nil
Expand All @@ -97,8 +104,31 @@ func (ctx *CDTContext) pack(cmd BufferEx) (int, Error) {
return size, err
}

sz, err = ctx.Value.pack(cmd)
size += sz
// For expression-based contexts, pack the expression bytes
if ctx.Expression != nil {
// Get the expression bytes
expSize, err := ctx.Expression.size()
if err != nil {
return size, err
}
expBuf := newBuffer(expSize)
_, err = ctx.Expression.pack(expBuf)
if err != nil {
return size, err
}
expBytes := expBuf.Bytes()

// Pack the expression bytes as a byte array and not as a blob!!
sz, err = packByteArray(cmd, expBytes)
size += sz
return size, err
}

// For value-based contexts, pack the value
if ctx.Value != nil {
sz, err = ctx.Value.pack(cmd)
size += sz
}

return size, err
}
Expand Down Expand Up @@ -146,25 +176,25 @@ func (ctxl cdtContextList) packArray(cmd BufferEx) (int, Error) {
// -1: Last item.
// -3: Third to last item.
func CtxListIndex(index int) *CDTContext {
return &CDTContext{ctxTypeListIndex, IntegerValue(index)}
return &CDTContext{ctxTypeListIndex, IntegerValue(index), nil}
}

// CtxListIndexCreate list with given type at index offset, given an order and pad.
func CtxListIndexCreate(index int, order ListOrderType, pad bool) *CDTContext {
return &CDTContext{ctxTypeListIndex | cdtListOrderFlag(order, pad), IntegerValue(index)}
return &CDTContext{ctxTypeListIndex | cdtListOrderFlag(order, pad), IntegerValue(index), nil}
}

// CtxListRank defines Lookup list by rank.
// 0 = smallest value
// N = Nth smallest value
// -1 = largest value
func CtxListRank(rank int) *CDTContext {
return &CDTContext{ctxTypeListRank, IntegerValue(rank)}
return &CDTContext{ctxTypeListRank, IntegerValue(rank), nil}
}

// CtxListValue defines Lookup list by value.
func CtxListValue(key Value) *CDTContext {
return &CDTContext{ctxTypeListValue, key}
return &CDTContext{ctxTypeListValue, key, nil}
}

// CtxMapIndex defines Lookup map by index offset.
Expand All @@ -176,28 +206,74 @@ func CtxListValue(key Value) *CDTContext {
// -1: Last item.
// -3: Third to last item.
func CtxMapIndex(index int) *CDTContext {
return &CDTContext{ctxTypeMapIndex, IntegerValue(index)}
return &CDTContext{ctxTypeMapIndex, IntegerValue(index), nil}
}

// CtxMapRank defines Lookup map by rank.
// 0 = smallest value
// N = Nth smallest value
// -1 = largest value
func CtxMapRank(rank int) *CDTContext {
return &CDTContext{ctxTypeMapRank, IntegerValue(rank)}
return &CDTContext{ctxTypeMapRank, IntegerValue(rank), nil}
}

// CtxMapKey defines Lookup map by key.
func CtxMapKey(key Value) *CDTContext {
return &CDTContext{ctxTypeMapKey, key}
return &CDTContext{ctxTypeMapKey, key, nil}
}

// CtxMapKeyCreate creates map with given type at map key.
func CtxMapKeyCreate(key Value, order mapOrderType) *CDTContext {
return &CDTContext{ctxTypeMapKey | order.flag, key}
return &CDTContext{ctxTypeMapKey | order.flag, key, nil}
}

// CtxMapValue defines Lookup map by value.
func CtxMapValue(value Value) *CDTContext {
return &CDTContext{ctxTypeMapValue, value}
return &CDTContext{ctxTypeMapValue, value, nil}
}

// CtxAllChildren creates a context that selects all children in a collection.
// This is useful for applying operations to all elements in a list or map.
// Equivalent to CTX.allChildren() in Java client.
//
// Example:
//
// ctx := []*CDTContext{
// CtxMapKey(StringValue("books")),
// CtxAllChildren(), // Select all books
// }
func CtxAllChildren() *CDTContext {
// Create an expression that always evaluates to true
expression := ExpBoolVal(true)
return &CDTContext{
Id: ctxTypeExpression,
Value: nil,
Expression: expression,
}
}

// CtxAllChildrenWithFilter creates a context that selects all children in a collection
// that match the given filter expression.
// Equivalent to CTX.allChildrenWithFilter() in Java client.
//
// Parameters:
// - exp: Filter expression to apply to each child element
//
// Example:
//
// // Select all books with price <= 10.0
// filterExp := ExpLessEq(
// ExpMapBin("price"),
// ExpFloatVal(10.0),
// )
// ctx := []*CDTContext{
// CtxMapKey(StringValue("books")),
// CtxAllChildrenWithFilter(filterExp),
// }
func CtxAllChildrenWithFilter(exp *Expression) *CDTContext {
return &CDTContext{
Id: ctxTypeExpression,
Value: nil,
Expression: exp,
}
}
33 changes: 26 additions & 7 deletions cdt_list.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@

package aerospike

import "github.com/aerospike/aerospike-client-go/v8/types"

// List operations support negative indexing. If the index is negative, the
// resolved index starts backwards from end of list. If an index is out of bounds,
// a parameter error will be returned. If a range is partially out of bounds, the
Expand Down Expand Up @@ -294,10 +296,19 @@ func packCDTIfcVarParamsAsArray(packer BufferEx, opType int16, ctx []*CDTContext
}
size += n

if n, err = c.Value.pack(packer); err != nil {
return size + n, err
if c.Value != nil {
if n, err = c.Value.pack(packer); err != nil {
return size + n, err
}
size += n
} else if c.Expression != nil {
if n, err = c.Expression.pack(packer); err != nil {
return size + n, err
}
size += n
} else {
return size, newError(types.PARAMETER_ERROR, "CDTContext must have either a Value or an Expression")
}
size += n
}

if n, err = packArrayBegin(packer, len(params)+1); err != nil {
Expand Down Expand Up @@ -369,11 +380,19 @@ func packCDTCreate(packer BufferEx, opType int16, ctx []*CDTContext, flag int, p
return size + n, err
}
size += n

if n, err = c.Value.pack(packer); err != nil {
return size + n, err
if c.Value != nil {
if n, err = c.Value.pack(packer); err != nil {
return size + n, err
}
size += n
} else if c.Expression != nil{
if n, err = c.Expression.pack(packer); err != nil {
return size + n, err
}
size += n
} else {
return size, newError(types.PARAMETER_ERROR, "CDTContext must have either a Value or an Expression")
}
size += n
}

c = ctx[last]
Expand Down
Loading
Loading