use new number type to be compatible with dynamo

This commit is contained in:
2026-02-16 08:45:30 -05:00
parent 089ef39bd9
commit f8b0b1c3ae
7 changed files with 680 additions and 45 deletions

View File

@@ -4,7 +4,6 @@
package dynamodb
import "core:encoding/json"
import "core:strconv"
import "core:strings"
// ============================================================================
@@ -775,21 +774,13 @@ compare_attribute_values :: proc(a: Attribute_Value, b: Attribute_Value) -> int
return -2
}
// For Numbers, do numeric comparison
_, a_is_num := a.(Number)
_, b_is_num := b.(Number)
// For Numbers, do with DDB_Number comparison
_, a_is_num := a.(DDB_Number)
_, b_is_num := b.(DDB_Number)
if a_is_num && b_is_num {
a_val, a_parse := strconv.parse_f64(a_str)
b_val, b_parse := strconv.parse_f64(b_str)
if a_parse && b_parse {
if a_val < b_val {
return -1
}
if a_val > b_val {
return 1
}
return 0
}
a_num := a.(DDB_Number)
b_num := b.(DDB_Number)
return compare_ddb_numbers(a_num, b_num)
}
return strings.compare(a_str, b_str)