Examples
The gocqlx repository contains extensive examples covering various use cases. You can view the full source code in example_test.go.
List of Examples
- Basic CRUD: Creating tables, inserting structs, querying single rows.
- All Data Types: Demonstrates mapping for all supported CQL data types including
blob,date,decimal, and collections. - UDTs: Using User Defined Types directly and via wrappers.
- JSON: Handling JSON columns with
QueryBuilder. - Paging: Implementing forward paging using page states.
- Full Table Scan: Efficiently scanning an entire table using token ranges and parallelism.
- LWT (Lightweight Transactions): Using Compare-And-Set (CAS) operations for locks.
- Partial Updates: Using
UnsetEmptyTransformerto handle partial updates without creating tombstones for empty fields.