Skip to content

GitLab

  • Menu
Projects Groups Snippets
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in
  • A api
  • Project information
    • Project information
    • Activity
    • Members
  • Packages & Registries
    • Packages & Registries
    • Package Registry
    • Container Registry
    • Infrastructure Registry
  • Wiki
    • Wiki
  • Activity
Collapse sidebar
  • ironapi
  • api
  • Wiki
  • Api
  • Queries
  • Attributes

Attributes · Changes

Page history
x authored Jan 21, 2022 by Andrea Pavlovic's avatar Andrea Pavlovic
Hide whitespace changes
Inline Side-by-side
API/Queries/Attributes.md
View page @ 863e3562
......@@ -173,11 +173,15 @@ Use `+columns` to get all columns of the base table plus certain ones from joine
# Select and As
The "select" and "as" attribues allow even more flexibility to define exactly what should be returned than "columns" does. Other than renaming a column,
functions may be used to select calculated values.
[permitted functions](#permitted-functions) may be used to select calculated values.
For each entry in "select" a corresponding entry in "as" must be present to name the result.
## Restrictions
Keys and values may not contain spaces.
Only [permitted functions](#permitted-functions) may be called. The value of the call might be itself a function call, like `{"max" : "coalesce(me.id,1)"}`.
This function must again be in the list of permitted functions and it's parameters can only be column identifiers or values which match the regular expression
used to check column names (`^[a-zA-Z0-9\.\_]+$`).
## Examples
......@@ -247,6 +251,21 @@ Returns one row:
}
```
Use another function:
```json
{
"attrs": {
"select": [
{
"max": "coalesce(me.id,1)"
}
],
"as": ["bla"]
}
}
```
"+select" and "+as" are also available.
<https://metacpan.org/pod/distribution/DBIx-Class/lib/DBIx/Class/ResultSet.pm#select>
......@@ -430,6 +449,18 @@ Note that "prefetch" is a shortcut for "join", adding all columns from the joine
https://metacpan.org/pod/distribution/DBIx-Class/lib/DBIx/Class/ResultSet.pm#collapse
# Permitted functions
For any attribute which allows to call a function, this function must be permitted. Apart from
- coalesce
- count
- least
- min
- max
other permitted functions may be listed for a project.
# Naming Conventions
When referencing to a column, the name without the table prefix can be used as long as it is unique within
......
Clone repository
  • API
    • Available Endpoints
    • Changing Passwords
    • Form Input Types
    • Introduction
    • Logout
    • Plugins
    • Queries
    • Queries
      • Attributes
      • Context
      • Query Examples
      • Query Search Options
      • Referenced Instances
      • Saved Queries
    • Schema_Changes
    • Storing Files
View All Pages