diff --git a/dynamodb/expression.odin b/dynamodb/expression.odin index 6013e54..5c563ca 100644 --- a/dynamodb/expression.odin +++ b/dynamodb/expression.odin @@ -111,7 +111,7 @@ tokenizer_next :: proc(t: ^Tokenizer) -> Maybe(string) { } // Single-character operators - if c == '=' || c == '<' || c == '>' { + if c == '=' || c == '<' || c == '>' || c == '+' || c == '-' { t.pos += 1 return t.input[start:t.pos] } @@ -138,9 +138,9 @@ is_whitespace :: proc(c: byte) -> bool { @(private = "file") is_ident_char :: proc(c: byte) -> bool { return (c >= 'a' && c <= 'z') || - (c >= 'A' && c <= 'Z') || - (c >= '0' && c <= '9') || - c == '_' || c == ':' || c == '#' || c == '-' || c == '.' + (c >= 'A' && c <= 'Z') || + (c >= '0' && c <= '9') || + c == '_' || c == ':' || c == '#' || c == '.' } // --------------------------------------------------------------------------- diff --git a/dynamodb/gsi.odin b/dynamodb/gsi.odin index 184053f..0949aa5 100644 --- a/dynamodb/gsi.odin +++ b/dynamodb/gsi.odin @@ -234,92 +234,6 @@ gsi_batch_delete_entries :: proc( return .None } -// ============================================================================ -// DEPRECATED - Non-atomic GSI maintenance -// -// These procedures are kept for backwards compatibility but should NOT be used. -// They perform individual database writes which is NOT atomic. -// Use gsi_batch_write_entries and gsi_batch_delete_entries instead. -// ============================================================================ - -// DEPRECATED: Use gsi_batch_write_entries instead for atomic operations. -// Write GSI entries for an item across all GSIs defined on the table. -// WARNING: This performs individual writes which is NOT atomic! -gsi_write_entries :: proc( - engine: ^Storage_Engine, - table_name: string, - item: Item, - metadata: ^Table_Metadata, -) -> Storage_Error { - gsis, has_gsis := metadata.global_secondary_indexes.? - if !has_gsis || len(gsis) == 0 { - return .None - } - - for &gsi in gsis { - // Extract GSI key from item - gsi_kv, kv_ok := gsi_extract_key_values(item, gsi.key_schema) - if !kv_ok { - continue // Sparse: item doesn't have GSI PK, skip - } - - // Build GSI storage key - gsi_storage_key := build_gsi_key(table_name, gsi.index_name, gsi_kv.pk, gsi_kv.sk) - defer delete(gsi_storage_key) - - // Build projected item - projected := gsi_project_item(item, &gsi, metadata.key_schema) - defer item_destroy(&projected) - - // Encode projected item - encoded, encode_ok := encode(projected) - if !encode_ok { - return .Serialization_Error - } - defer delete(encoded) - - // Write to RocksDB - put_err := rocksdb.db_put(&engine.db, gsi_storage_key, encoded) - if put_err != .None { - return .RocksDB_Error - } - } - - return .None -} - -// DEPRECATED: Use gsi_batch_delete_entries instead for atomic operations. -// Delete GSI entries for an item across all GSIs. -// WARNING: This performs individual writes which is NOT atomic! -gsi_delete_entries :: proc( - engine: ^Storage_Engine, - table_name: string, - old_item: Item, - metadata: ^Table_Metadata, -) -> Storage_Error { - gsis, has_gsis := metadata.global_secondary_indexes.? - if !has_gsis || len(gsis) == 0 { - return .None - } - - for &gsi in gsis { - gsi_kv, kv_ok := gsi_extract_key_values(old_item, gsi.key_schema) - if !kv_ok { - continue // Item didn't have a GSI entry - } - - gsi_storage_key := build_gsi_key(table_name, gsi.index_name, gsi_kv.pk, gsi_kv.sk) - defer delete(gsi_storage_key) - - del_err := rocksdb.db_delete(&engine.db, gsi_storage_key) - if del_err != .None { - return .RocksDB_Error - } - } - - return .None -} - // ============================================================================ // GSI Query //