GLQL functions
- Tier: Free, Premium, Ultimate
- Offering: GitLab.com, GitLab Self-Managed
- Status: Experiment
The availability of this feature is controlled by a feature flag. For more information, see the history. This feature is available for testing, but not ready for production use.
Use functions with GitLab Query Language (GLQL) to create dynamic queries.
Functions inside query
To make a query context-specific, use functions inside a query, for example, by filtering by a current user or a date.
Current user
Function name: currentUser
Parameters: None
Syntax: currentUser()
Description: Evaluates to the current authenticated user.
Additional details:
- Using this function in a query makes the query fail for users who are not authenticated.
Examples:
List all issues where the current authenticated user is the assignee:
assignee = currentUser()
List all merge requests where the current authenticated user is the assignee but not the author:
type = MergeRequest and assignee = currentUser() and author != currentUser()
Today
Function name: today
Parameters: None
Syntax: today()
Description: Evaluates to today’s date at 00:00 in the user’s time zone.
Additional details:
- When used with the
=
operator, the time range is considered from 00:00 to 23:59 in the user’s time zone.
Examples:
List all issues created today:
created = today()
List all merge requests merged today:
type = MergeRequest and merged = today()
Functions in GLQL views
To derive a new column from an existing field of a GLQL view, include
functions in the fields
parameter.
Extract labels into a new column
Function name: labels
Parameters: One or more String
values
Syntax: labels("field1", "field2")
Description:
The labels
function takes one or more label name string values as parameter,
and creates a filtered column with only those labels on issues.
The function also works as an extractor, so if a label has been extracted, it no longer shows up
in the regular labels
column, if you choose to display that column as well.
Additional details:
- By default, this function looks for an exact match to the label name.
A wildcard character (
*
) in the string to match any character. - A minimum of 1 and maximum of 100 label names can be passed to the
labels
function. - Label names passed to this function are case-insensitive. For example,
Deliverable
anddeliverable
are equivalent.
Examples:
Include all
workflow
scoped labels in the column:labels("workflow::*")
Include labels
Deliverable
,Stretch
, andSpike
:labels("Deliverable", "Stretch", "Spike")
Include all labels like
backend
,frontend
, and others that end withend
:labels("*end")
To include the labels
function in a GLQL view:
```glql
display: list
fields: title, health, due, labels("workflow::*"), labels
limit: 5
query: project = "gitlab-org/gitlab" AND assignee = currentUser() AND opened = true
```
Docs
Edit this page to fix an error or add an improvement in a merge request.
Create an issue to suggest an improvement to this page.
Product
Create an issue if there's something you don't like about this feature.
Propose functionality by submitting a feature request.
Feature availability and product trials
View pricing to see all GitLab tiers and features, or to upgrade.
Try GitLab for free with access to all features for 30 days.
Get help
If you didn't find what you were looking for, search the docs.
If you want help with something specific and could use community support, post on the GitLab forum.
For problems setting up or using this feature (depending on your GitLab subscription).
Request support