v1.10.0
Install
luarocks install lapis
Additions
Model:include_in
supports a new{ load = false }
option to disable the conversion of query results to model instances- You can now specify
{ order = false }
when creating a paginator from a model relation to strip the default order that may have been specified in the relation definition lapis.util.utf8
: Add a UTF8 aware trim LPeg pattern, calledtrim
) (Note: the utility functiontrim
locatedlapis.util
still only operates on ascii whitespace)
Postgres
model:update
method can take awhere
clause to apply a conditional update- The return value of
model:update
is now well defined, and works similar tomodel:delete
. Will return booleantrue
/false
depending on if the update was able complete, and the resulting object from the update query. (Warning: Previouslymodel:update
would return the result object regardless of success as the first return value, but this functionality was undocumented.) db.insert
can now take options as a table, and supports receivingreturning
columns as a option- Add the
{ on_conflict = "do_nothing" }
option todb.insert
to not throw an error if insertion is canceled due to a unique key constraint conflict (using theON CONFLICT DO NOTHING
query syntax introduced in Postgres 9.5)
MySQL
model:update
will returntrue
if the number of affected rows is greater than 0, followed by the result object
Changes
lapis.html
: All element helper methods (eg.div
,b
,span
, etc.) now returnnil
instead of the previously undocumented behavior of returning the buffer object. This is to prevent accidentally leaking data when writing malformed syntax such asdiv div!
(instead of the correct (div -> div!
)lapis.util.utf8
: whitespace pattern is aware of invalid use of direction markerslapis.db.postgres.model
: On model creation, if areturning *
clause is provided then unnecessary extra returning fields are not included in the querylapis.db.postgres
: Nginx environment detection is more accurate to allow pgmoon connections to be created without error in more stages of the Nginx worker/request lifecyclelapis.db.postgres
: OpenResty specific performance metrics about socket reuse are only written when an nginx socket is in uselapis.db.postgres
: Add connection specific performance metric for when any socket type other than nginx is used
Bugs
lapis.validate
: Fixed bug where the input options table passed into validate would get mutated, removing theoptional
field
Misc
- Assorted updates to docs
- Expanded test suite, refactors to tests
- Documentation typo fixes by @tommy-mor in #734 #746
New Contributors
- @tommy-mor made their first contribution in #734
Full Changelog: v1.9.0...v1.10.0