10 Commits

Author SHA1 Message Date
3e19b3628d Use a connection provider rather than long-lived connections.
The previous implementation expected to work with a context object that
contained a field `conn` that represented a valid database connection.
However, this required the caller to manage the connection's lifecycle
(close, renew, etc.). Now we expect to receive a context object that
provides a `withConn` procedure or template that accepts a statement
block and provides a `conn` variable to that code block. For example:

    createRecord(db: DbContext): Record =
        # withConn must be defined for DbContext
        db.withConn:
          # conn must be injected into the statement block context
          conn.exec(sql("INSERT INTO..."))

In addition, this change provides a connection pooling mechanism
(`DbConnPool`) as a default implementation for this hypothetical
DbContext. There is also a new function `initPool` that will create an
DbConnPool instance.

Callers of this library can modify their DbContext objects to extend
DbConnPool or simply be a type alias of DbConnPool.
2022-02-07 11:38:37 -06:00
8aad3cdb79 Make the logging namespace GC-safe. 2022-01-22 20:23:30 -06:00
f7791b6f60 Add logging statments (behind namespaced logger). 2022-01-13 16:22:15 -06:00
279d9aa7fd Expose a number of useful utility methods and macros. 2021-08-02 05:54:56 -05:00
126167fdaf Fix name mapping in field lookups generation. 2021-07-02 20:16:49 -05:00
ff0c5e5305 Update to support Nim 1.4.x+ 2021-04-02 13:58:08 -05:00
61e06842af Use the more intelligent pluralization method we built when generating findXsByField lookup functions. 2020-01-02 18:46:03 -06:00
934bb26cf3 Make the DB type object generic (not PmApiDb). 2020-01-02 18:44:44 -06:00
126c4f1c7c Make record not found error messages more descriptive. 2020-01-02 18:42:48 -06:00
35af299fdc Rename module from 'fiber_orm_nim' to 'fiber_orm'. 2019-12-25 18:51:00 -06:00