Repository navigation
v1.11.0
Install
luarocks install lapis
Highlights
- Substantially improved performance for
url_forgeneration - Introduce
db.clause - Lua is now first class. Etlua improvements. Application class APIs match Lua & MoonScript. Documentation and APIs show Lua by default
- Homepage and documentation have been substantially updated
Additions
lapis.dbAdd thedb.clauseconstructor for safely building SQL fragments including clauses and conditionals- All db related methods can now take
db.clauseobjects when appropriate for configuring filtering (eg.Model:find, relationwhere:clause, etc.) lapis.dbThelapis.db.encode_clausefunction can be used to convert adb.clauseobject a fragment of SQL codelapis.applicationAddApplication:extend()method to create a sub-class ofApplicationwhen MoonScript is not availablelapis.applicationAll route related methods are now consistently available for both application instances and classes. This includesinclude,match,extend,find_action,before_filter,get,post,put,deletelapis.sessionTheget_sessionfunction can now take a string object as first argument, as an alternative to the request object, to decode a session from a cookie's string valuelapis.htmlAddWidget:extend()method for creating sublcass of theWidgetclass when MoonScript is not availablelapis.htmlTheclassnamesfunction will now recurisvely evaluate any tables in the argumentlapis.htmlAddis_mixins_classfunction to determine if a class is a dynamically generated mixin class created byWidget:includelapis.etluaTheelementfunction has been added to the template scope to allow rendering HTML elements programmatically (similar to the HTML builder syntax)lapis.etluaselfhas been added to the template scope to allow accessing the instance of theEtluaWidget- The
lapis migratecommand now supports a--transactionflag, can be set toglobalto apply a transaction across all migrations to be run, orindividualto apply a transaction to each migration run. lapis.flowAddFlow:extend()method for sublcassing theFlowclass
Changes
lapis.dbInternally, queries now usedb.clauseto generate SQL conditional statements . This means that order of certain fields may now be different when usingwhereclauses.lapis.dbIt is no longer possible to override fields configured by a relation when specifying awhere:option. This also applies to paginators generated for relationslapis.db.modelRelations can now be specified with a direct reference to a Model class, or a function that should resolve to a Model class (existing support for relation name has not changed)lapis.applicationInheritance of routes is now more well defined, allowing for route names and paths to be overidden by subclasses or instances during the creation of the router. If you aren't using application inheritance then this will not affect you.lapis.applicationLazy action loading is now supported for actions generated byincludeand actions built by the HTTP verbmatchhelpers (get,post, etc.). Previously, if provided an action name (ortrue), it would load the action module immediately. Now all named actions are consistently loaded on first request regardless of where they are usedlapis.applicationThefind_actionmethod now searches up inheritance hierarchy, and can be used on both app classes and instanceslapis.applicationTrying to callenableormatchdirectly on thelapis.Applicationclass reference will now throw an error to help prevent accidentally mutating the global objectlapis.htmlTheWidget:render()method will now return nothing instead ofnillapis.routerRouter URL creation (akaurl_for) has been rewritten to be substantially faster. Previously routes were re-parsed on calls tourl_forbut will not generate from a cached intermediate form that will allow the URL to be generated with little overhead.lapis.cqueuesAdd error capturing around the app boot process to provide better error message when attempting to load a faulty app, and prevent infinite loop processing bug fromlua-http- The environment variable
LAPIS_FORCE_LOGGINGcan not be set to0to force logging off - The
applicationfield is no longer present on thelapis.initmodule. This was never documented. Userequire("lapis.application")instead. - Many error messages have been rewritten to be prefixed with the module or method they originate from
Internal Changes
These changes should have no effect on the end user implementing an app, but
they are documented here in case you were depending on the undocumented
structure of lapis
lapis.applicationThe internal structure used by the HTTP verbmatchhelpers has been changed (get,post, etc.)lapis.routerParsed routes are now stored, and the arguments forfill_pathhave changedlapis.applicationThe way routes are internally managed and iterated has been rewritten to provide unified interface based on metatable inheritance. Thelapis.application.route_groupmodule has been added to work with this interface.
Misc
- Substantial updates to documentation, including rewrites for clarify and documenting fields that were previously not documented.
- Changes to the homepage to prioritize Lua syntax over MoonScript to reduce confusion about what & who the framework is for
Full Changelog: v1.10.0...v1.11.0