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

  1. Basic CRUD: Creating tables, inserting structs, querying single rows.
  2. All Data Types: Demonstrates mapping for all supported CQL data types including blob, date, decimal, and collections.
  3. UDTs: Using User Defined Types directly and via wrappers.
  4. JSON: Handling JSON columns with QueryBuilder.
  5. Paging: Implementing forward paging using page states.
  6. Full Table Scan: Efficiently scanning an entire table using token ranges and parallelism.
  7. LWT (Lightweight Transactions): Using Compare-And-Set (CAS) operations for locks.
  8. Partial Updates: Using UnsetEmptyTransformer to handle partial updates without creating tombstones for empty fields.

View example_test.go on GitHub