lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


This is a project of mine that has been sitting without a release for
a long time now.
With luapgsql recently getting the last fixes I was waiting for, I
figured it's time to do a proper release.

cqueues-pgsql is a library that wraps luapgsql to be non-blocking when
in a cqueues managed thread.
The API should be the same as luapgsql; if it diverges, file a bug with me :)
Homepage: https://github.com/daurnimator/cqueues-pgsql
Available on luarocks: https://luarocks.org/modules/daurnimator/cqueues-pgsql/

Q. What is luapgsql?
A. Bindings to libpq, i.e. a postgresql client.
Homepage: https://github.com/arcapos/luapgsql/

Q. What is cqueues?
A. A library for cooperative threading in lua.
Homepage: http://25thandclement.com/~william/projects/cqueues.html
Github: https://github.com/wahern/cqueues

Q. When do I want to use cqueues-pgsql?
A. When you want to talk to postgres without blocking your entire
application/thread.

Q. So I can only use it in a cqueues managed thread/application?
A. No! if used outside of a cqueues managed thread, cqueues-pgsql will
appear to operate in a blocking manner.
i.e. it will look and behave just like luapgsql.

Q. Show me an example!
A. That's not a question, but okay:
$ lua
Lua 5.3.3  Copyright (C) 1994-2016 Lua.org, PUC-Rio
> require"cqueues_pgsql".connectdb"":exec("SELECT 42"):getvalue(1,1)
42


Enjoy!
daurnimator.