A pure Lua PostgreSQL client library for OpenResty, LuaSocket, cqueues, and LuaPosix environments.
pgmoon is a PostgreSQL client library written in pure Lua. It enables Lua applications to connect to and query PostgreSQL databases, supporting multiple socket backends like OpenResty's cosocket, LuaSocket, cqueues, and LuaPosix. It solves the need for a lightweight, portable database driver that works seamlessly across different Lua environments, especially in asynchronous contexts.
Lua developers building web applications with OpenResty, or any Lua project requiring PostgreSQL database connectivity. It's particularly valuable for those needing asynchronous query support in high-performance server environments.
Developers choose pgmoon because it's a pure Lua solution with no external C dependencies, offers a consistent API across multiple Lua environments, and provides advanced features like connection pooling, SSL support, and automatic type conversion. Its integration with OpenResty's cosocket API makes it ideal for non-blocking database operations in web servers.
A pure Lua Postgres driver for use in OpenResty & more
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Written entirely in Lua with no C dependencies, ensuring easy integration and portability across Lua environments, as emphasized in the GitHub description.
Leverages OpenResty's cosocket API for non-blocking database operations, making it ideal for high-performance web applications with minimal latency.
Automatically converts PostgreSQL types like JSON, arrays, and hstore to Lua types, with support for custom deserializers and serializers for extended flexibility.
Works with OpenResty, LuaSocket, cqueues, and LuaPosix, providing a consistent API across different Lua setups and socket implementations.
As admitted in the README, repeated field names in SQL results are overwritten in Lua tables with no workaround, leading to potential data loss in queries.
Requires installing external libraries like lua-cjson for JSON, luaossl for crypto, and lpeg for arrays, complicating setup and deployment.
Using parameterized queries with the extended protocol incurs significant performance overhead, making simple queries up to 100% slower, as noted in the trade-offs section.