mirror of
https://github.com/hasura/graphql-engine.git
synced 2024-12-15 01:12:56 +03:00
docs: add examples for regex operators (closes #6919)
GITHUB_PR_NUMBER: 7691 GITHUB_PR_URL: https://github.com/hasura/graphql-engine/pull/7691 PR-URL: https://github.com/hasura/graphql-engine-mono/pull/2618 Co-authored-by: Rafael Baldasso Audibert <32079912+rafaeelaudibert@users.noreply.github.com> Co-authored-by: Rikin Kachhia <54616969+rikinsk@users.noreply.github.com> GitOrigin-RevId: eeec4eba087c10d7008092a1f70acc82e73c4fcc
This commit is contained in:
parent
9f35e660c0
commit
ec4ef91273
@ -472,8 +472,8 @@ Fetch a list of those authors whose names are NOT part of a list:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Text search or pattern matching operators (_like, _similar, etc.)
|
Text search or pattern matching operators (_like, _similar, _regex, etc.)
|
||||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
The ``_like``, ``_nlike``, ``_ilike``, ``_nilike``, ``_similar``, ``_nsimilar``, ``_regex``, ``_nregex``, ``_iregex``, ``_niregex`` operators are used for
|
The ``_like``, ``_nlike``, ``_ilike``, ``_nilike``, ``_similar``, ``_nsimilar``, ``_regex``, ``_nregex``, ``_iregex``, ``_niregex`` operators are used for
|
||||||
pattern matching on string/text fields.
|
pattern matching on string/text fields.
|
||||||
@ -497,21 +497,23 @@ Fetch a list of articles whose titles contain the word “amet”:
|
|||||||
}
|
}
|
||||||
:response:
|
:response:
|
||||||
{
|
{
|
||||||
"data": {
|
"data": {
|
||||||
"articles": [
|
"articles": [
|
||||||
{
|
{
|
||||||
"id": 1,
|
"id": 1,
|
||||||
"title": "sit amet"
|
"title": "sit amet"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": 3,
|
"id": 3,
|
||||||
"title": "amet justo morbi"
|
"title": "amet justo morbi"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": 9,
|
"id": 9,
|
||||||
"title": "sit amet"
|
"title": "sit amet"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
.. note::
|
.. note::
|
||||||
|
|
||||||
@ -561,6 +563,49 @@ Fetch a list of authors whose names begin with A or C:
|
|||||||
|
|
||||||
``_similar`` is case-sensitive
|
``_similar`` is case-sensitive
|
||||||
|
|
||||||
|
**Example: _regex**
|
||||||
|
|
||||||
|
Fetch a list of articles whose titles match the regex “[ae]met”:
|
||||||
|
|
||||||
|
.. graphiql::
|
||||||
|
:view_only:
|
||||||
|
:query:
|
||||||
|
query {
|
||||||
|
articles(
|
||||||
|
where: {title: {_regex: "[ae]met"}}
|
||||||
|
) {
|
||||||
|
id
|
||||||
|
title
|
||||||
|
}
|
||||||
|
}
|
||||||
|
:response:
|
||||||
|
{
|
||||||
|
"data": {
|
||||||
|
"articles": [
|
||||||
|
{
|
||||||
|
"id": 1,
|
||||||
|
"title": "sit amet"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": 3,
|
||||||
|
"title": "cremet justo morbi"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": 9,
|
||||||
|
"title": "sit ametist"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.. note::
|
||||||
|
|
||||||
|
``_regex`` is case-sensitive. Use ``_iregex`` for case-insensitive search.
|
||||||
|
|
||||||
|
.. note::
|
||||||
|
|
||||||
|
``regex`` operators are supported in in ``v2.0.0`` and above
|
||||||
|
|
||||||
JSONB operators (_contains, _has_key, etc.)
|
JSONB operators (_contains, _has_key, etc.)
|
||||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user