Databases
Three ways into a database from Zig, at three different levels. SQLite through its C API, which is the shortest path to durable storage and a good look at how Zig links C. The PostgreSQL wire protocol written out by hand, startup message through row description, because the protocol is simpler than its client libraries suggest. And Redis RESP, which is small enough to parse in one page. For a query layer on top of these, see the ORM chapters under Projects.
3 chapters.
- Recipe: SQLite From ZigOpen a database, create a table, insert with a prepared statement, and query, over the C API.
- Recipe: A Redis RESP Round TripSpeak Redis's RESP protocol over a socket, with a tiny server and client in one process.
- Recipe: The PostgreSQL Wire ProtocolSpeak Postgres directly, framing a startup handshake and a query by hand.