lc-pg-dao is a lightweight PostgreSQL DAO utility for Node.js, wrapping pg-pool to provide simple table creation, auto-ID generation, and CRUD operations. Version 1.1.12 is the latest stable release. The library is primarily used in Chinese-speaking developer communities, as documented in Chinese. It differentiates itself by offering a simple configuration object for database connection and a chainable API for table creation with support for unique keys, auto-increment IDs, and operator ID fields.
npm install lc-pg-daoNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Initializes a PostgreSQL connection using lc-pg-dao, connects to the database, and creates a simple table with auto-generated ID.
Always assign the result of dao(config) to a variable before accessing client or create.
Pass an object with a top-level 'config' property containing your connection parameters.
Test the connection by executing a simple query after client() resolves.
Use require() or wrap it in a dynamic import with a module that supports CommonJS.
Replace 'import dao from 'lc-pg-dao'' with 'const dao = require('lc-pg-dao')'.Call dao(config) and store the result: const { client } = dao(config);Ensure you call create() after client() resolves and handle the promise properly.