Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Uri parameters in vars expression #142

Draft
wants to merge 9 commits into
base: master
Choose a base branch
from

Commits on Jan 8, 2024

  1. Match params before vars

    This will allow us to use the matched params as part of the vars later.
    boekkooi-lengoo committed Jan 8, 2024
    Configuration menu
    Copy the full SHA
    796828b View commit details
    Browse the repository at this point in the history
  2. Add uri_param_ to vars

    This adds `uri_param_<name>` allowing vars and filters access to the parameters of a uri.
    By doing this we are able to improve validation of routes to specific params.
    boekkooi-lengoo committed Jan 8, 2024
    Configuration menu
    Copy the full SHA
    c767551 View commit details
    Browse the repository at this point in the history
  3. Remove duplicate code

    As match_route_opts now handles both the opts and params we can set the matched information in match_route_opts to avoid some duplicate code.
    boekkooi-lengoo committed Jan 8, 2024
    Configuration menu
    Copy the full SHA
    a454f56 View commit details
    Browse the repository at this point in the history
  4. use clone_tab

    It seems `setmetatable` is very slow and was destroying the benchmark. For this reason we now use `clone_tab` and add the uri matches.
    boekkooi-lengoo committed Jan 8, 2024
    Configuration menu
    Copy the full SHA
    2b9f67d View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    f673ca6 View commit details
    Browse the repository at this point in the history
  6. Hide capture group

    No need to capture this data.
    boekkooi-lengoo committed Jan 8, 2024
    Configuration menu
    Copy the full SHA
    dd7af11 View commit details
    Browse the repository at this point in the history

Commits on Jan 12, 2024

  1. Implicit nil return

    There is no need to return `nil` as this is the default so let's avoid adding it.
    boekkooi-lengoo committed Jan 12, 2024
    Configuration menu
    Copy the full SHA
    c32baae View commit details
    Browse the repository at this point in the history

Commits on Jan 23, 2024

  1. Handle __index metamethod properly

    [table.clone](https://github.com/openresty/luajit2#tableclone) won't copy metamethods.
    So in order to avoid any issues the [__index](https://www.lua.org/pil/13.4.1.html) metamethod is added to the new ops_vars.
    boekkooi-lengoo committed Jan 23, 2024
    Configuration menu
    Copy the full SHA
    22f0010 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    d5ed57b View commit details
    Browse the repository at this point in the history