fix tingz
This commit is contained in:
@@ -5,6 +5,7 @@ package dynamodb
|
||||
|
||||
import "core:encoding/json"
|
||||
import "core:strings"
|
||||
import "core:mem"
|
||||
|
||||
// ============================================================================
|
||||
// ProjectionExpression
|
||||
@@ -142,6 +143,7 @@ Filter_Node :: struct {
|
||||
right: ^Filter_Node,
|
||||
// For Not
|
||||
child: ^Filter_Node,
|
||||
allocator: mem.Allocator, // allocator that created this node
|
||||
}
|
||||
|
||||
filter_node_destroy :: proc(node: ^Filter_Node) {
|
||||
@@ -171,8 +173,8 @@ filter_node_destroy :: proc(node: ^Filter_Node) {
|
||||
filter_node_destroy(node.child)
|
||||
}
|
||||
|
||||
// Free the node itself (allocated with new(Filter_Node))
|
||||
free(node)
|
||||
// Free the node itself using the allocator that created it
|
||||
free(node, node.allocator)
|
||||
}
|
||||
|
||||
// ============================================================================
|
||||
@@ -224,7 +226,7 @@ parse_or_expr :: proc(
|
||||
return nil, false
|
||||
}
|
||||
|
||||
parent := new(Filter_Node)
|
||||
parent := make_filter_node()
|
||||
parent.type = .Or
|
||||
parent.left = left
|
||||
parent.right = right
|
||||
@@ -263,7 +265,7 @@ parse_and_expr :: proc(
|
||||
return nil, false
|
||||
}
|
||||
|
||||
parent := new(Filter_Node)
|
||||
parent := make_filter_node()
|
||||
parent.type = .And
|
||||
parent.left = left
|
||||
parent.right = right
|
||||
@@ -294,7 +296,7 @@ parse_not_expr :: proc(
|
||||
if !child_ok {
|
||||
return nil, false
|
||||
}
|
||||
node := new(Filter_Node)
|
||||
node := make_filter_node()
|
||||
node.type = .Not
|
||||
node.child = child
|
||||
return node, true
|
||||
@@ -390,7 +392,7 @@ parse_primary_expr :: proc(
|
||||
return nil, false
|
||||
}
|
||||
|
||||
node := new(Filter_Node)
|
||||
node := make_filter_node()
|
||||
node.type = .Comparison
|
||||
node.path = path
|
||||
node.comp_op = comp_op
|
||||
@@ -437,7 +439,7 @@ parse_filter_begins_with :: proc(
|
||||
return nil, false
|
||||
}
|
||||
|
||||
node := new(Filter_Node)
|
||||
node := make_filter_node()
|
||||
node.type = .Begins_With
|
||||
node.path = path
|
||||
node.value = val
|
||||
@@ -483,7 +485,7 @@ parse_filter_contains :: proc(
|
||||
return nil, false
|
||||
}
|
||||
|
||||
node := new(Filter_Node)
|
||||
node := make_filter_node()
|
||||
node.type = .Contains
|
||||
node.path = path
|
||||
node.value = val
|
||||
@@ -514,7 +516,7 @@ parse_filter_attr_exists :: proc(
|
||||
return nil, false
|
||||
}
|
||||
|
||||
node := new(Filter_Node)
|
||||
node := make_filter_node()
|
||||
node.type = .Attribute_Exists if exists else .Attribute_Not_Exists
|
||||
node.path = path
|
||||
return node, true
|
||||
@@ -552,7 +554,7 @@ parse_filter_between :: proc(
|
||||
return nil, false
|
||||
}
|
||||
|
||||
node := new(Filter_Node)
|
||||
node := make_filter_node()
|
||||
node.type = .Between
|
||||
node.path = path
|
||||
node.value = lo_val
|
||||
@@ -613,7 +615,7 @@ parse_filter_in :: proc(
|
||||
}
|
||||
}
|
||||
|
||||
node := new(Filter_Node)
|
||||
node := make_filter_node()
|
||||
node.type = .In
|
||||
node.path = path
|
||||
node.in_values = in_vals[:]
|
||||
@@ -819,3 +821,13 @@ parse_filter_expression_string :: proc(request_body: []byte) -> (expr: string, o
|
||||
ok = true
|
||||
return
|
||||
}
|
||||
|
||||
// ============================================================================
|
||||
// Allocator Helper
|
||||
// ============================================================================
|
||||
|
||||
make_filter_node :: proc() -> ^Filter_Node {
|
||||
node := make_filter_node()
|
||||
node.allocator = context.allocator
|
||||
return node
|
||||
}
|
||||
Reference in New Issue
Block a user