How bennyelg/nimpresto works
Project type and purpose
• This is an open-source Nim library (“db_presto”) that provides a Presto (PrestoDB) connector.
• Its purpose is to allow Nim programs to authenticate, send SQL queries to a Presto server over HTTP(S), and retrieve results.
File structure
• Top-level files:
• db_presto.nim → the main Nim module implementing the connector
• db_presto.nimble → Nimble package manifest (dependencies, metadata)
• Dockerfile → containerize tests or demo
• .travis.yml → CI configuration
• tests/db_presto_test.nim → unit tests for connection, query execution, fetchOne/Many/All
• No “frontend” or “backend” folders; this is a single library with tests and CI.
README for additional insights
• Features: newPrestoClient(), cursor(), execute(), fetchOne/Many/All(), authentication.
• Usage shows a client-cursor-execute workflow.
Elements
• Clear rectangular blocks for each component (Client App, PrestoClient, Cursor, HTTP Client, JSON Parser, Presto Server, Nimble, Docker)
• From Client App → PrestoClient → Cursor → HTTP Client → Presto Server
• From Presto Server → JSON Parser → Cursor → Client App
• Blue for library components
• Green for external systems (Presto Server, Docker)
• Gray for tooling (Nimble, Travis CI)
Detailed breakdown—divide “db_presto” into these sub-components
• PrestoClient
• Authentication Handler
• Cursor / QueryContext
• HTTP Transport Adapter
• Response Parser (JSON → Nim objects)
• Error Handling Module
Final Tips:
• Configuration parameters (host, port, catalog, schema, user, password) near the PrestoClient block