fix expression aritmetic
This commit is contained in:
@@ -111,7 +111,7 @@ tokenizer_next :: proc(t: ^Tokenizer) -> Maybe(string) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Single-character operators
|
// Single-character operators
|
||||||
if c == '=' || c == '<' || c == '>' {
|
if c == '=' || c == '<' || c == '>' || c == '+' || c == '-' {
|
||||||
t.pos += 1
|
t.pos += 1
|
||||||
return t.input[start:t.pos]
|
return t.input[start:t.pos]
|
||||||
}
|
}
|
||||||
@@ -140,7 +140,7 @@ is_ident_char :: proc(c: byte) -> bool {
|
|||||||
return (c >= 'a' && c <= 'z') ||
|
return (c >= 'a' && c <= 'z') ||
|
||||||
(c >= 'A' && c <= 'Z') ||
|
(c >= 'A' && c <= 'Z') ||
|
||||||
(c >= '0' && c <= '9') ||
|
(c >= '0' && c <= '9') ||
|
||||||
c == '_' || c == ':' || c == '#' || c == '-' || c == '.'
|
c == '_' || c == ':' || c == '#' || c == '.'
|
||||||
}
|
}
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
|
|||||||
@@ -234,92 +234,6 @@ gsi_batch_delete_entries :: proc(
|
|||||||
return .None
|
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
|
// GSI Query
|
||||||
//
|
//
|
||||||
|
|||||||
Reference in New Issue
Block a user