This phase delivered advanced filtering capabilities and database optimizations for the Go/Bbolt target.
- Declaration:
:- index(predicate/arity, field). - Write Path: Automatically creates
index_Pred_Fieldbuckets and maintainsValue:PrimaryKeyentries. - Read Path: Uses
cursor.Seek()andbytes.HasPrefix()for optimized range scans when filters match indexed fields.
- Case-Insensitive Equality:
Field =@= "Value"maps tostrings.EqualFold(). - Substring Match:
contains(Field, "Sub")maps tostrings.Contains().
- Syntax:
member(Field, [Val1, Val2]). - Implementation: Generates efficient Go loops/slices to check membership.
- Direct Lookup: Uses
bucket.Get()for exact Primary Key matches. - Prefix Scan: Uses
cursor.Seek()for composite Primary Key prefix matches. - Index Scan: Uses
cursor.Seek()on Secondary Index buckets for indexed field matches. - Fallback: Gracefully falls back to full bucket scan if no index/key optimization is possible.
tests/test_go_index.pl: Verified index creation and write logic.tests/test_go_index_read.pl: Verified optimized read logic (Index Scan).tests/test_go_phase_8b.pl: Verified string ops and membership.