Examples
Practical examples for DB usage with MySQL, PostgreSQL, Scylla, and shared database helpers.
Practical examples are available in the official examples repository:
https://github.com/netlifeguru/examples/dbThe repository contains standalone examples covering database connections, typed queries, maps, scalar values, inserts, updates, deletes, dialect SQL, SQL files, transactions, Scylla batches, lightweight transactions, and shared DB helper behavior.
MySQL Examples
MySQL examples are available at:
https://github.com/netlifeguru/examples/db/mysqlThese examples demonstrate the shared DB API with the MySQL driver, including MySQL placeholders, LastInsertId, SQL transactions, and MySQL SQL files.
- Connect
- Ping
- Create schema
- Insert
- Select list
- Select get
- Select value
- Select map
- Query list
- Query get
- Query value
- Query map
- Dialect list
- Dialect get
- Dialect value
- Dialect map
- Update
- Delete
- SQL files
- SQL files dialect
- SQL files insert
- SQL files update delete
- Transactions
- Low-level transactions
PostgreSQL Examples
PostgreSQL examples are available at:
https://github.com/netlifeguru/examples/db/postgresqlThese examples demonstrate the shared DB API with the PostgreSQL driver, including numbered placeholders, RETURNING inserts, SQL transactions, PostgreSQL SQL files, and multi-driver SQL files.
- Connect
- Ping
- Create schema
- Insert
- Select list
- Select get
- Select value
- Select map
- Query list
- Query get
- Query value
- Query map
- Dialect list
- Dialect get
- Dialect value
- Dialect map
- Update
- Delete
- SQL files
- SQL files dialect
- SQL files insert
- SQL files update delete
- Transactions
- Low-level transactions
- Multi-driver SQL files
Scylla Examples
Scylla examples are available at:
https://github.com/netlifeguru/examples/db/scyllaThese examples demonstrate the shared DB API with the Scylla driver, including CQL placeholders, keyspaces, query tables, batches, SQL files, and lightweight transactions.
- Connect
- Ping
- Create schema
- Insert
- Select list
- Select get
- Select value
- Select map
- Query list
- Query get
- Query value
- Query map
- Dialect list
- Dialect get
- Dialect value
- Dialect map
- Update
- Delete
- SQL files
- SQL files dialect
- SQL files insert
- SQL files update delete
- Batch
- Low-level batch
- Lightweight transaction
- Lightweight transaction map
- Lightweight transaction low-level
DB Dumb Examples
DB dumb examples are available at:
https://github.com/netlifeguru/examples/db/dumbThese examples demonstrate shared DB helper behavior without focusing on a specific production driver.
Recommended Starting Points
Start with the driver you use:
Then continue with the shared query examples:
05_select_list06_select_get07_select_value08_select_map
For SQL files and multi-driver usage, see: