Oihana PHP Arango

isKey.php

Table of Contents

Functions

isKey()  : string
Builds an AQL expression that checks whether a value is a valid document key.

Functions

isKey()

Builds an AQL expression that checks whether a value is a valid document key.

isKey(string $value) : string

This helper wraps the ArangoDB AQL function IS_KEY(), which tests if the given value is a string that can be used as the _key attribute of a document.

The function returns true if the string matches ArangoDB’s key format rules:

  • Contains only letters, digits, and the characters _, -, :, or @.
  • Does not contain /, whitespace, or control characters.
  • Must not be empty.

Example AQL output:

IS_KEY(user._key)
Parameters
$value : string

The AQL field or string expression to check (e.g. 'user._key').

Tags
example
use function oihana\arango\db\functions\isKey;

$expr = isKey('user._key');
// Produces: 'IS_KEY(user._key)'
see
https://docs.arangodb.com/stable/aql/functions/type-check-and-cast/#is_key
since
1.0.0
author

Marc Alcaraz

Return values
string

The formatted AQL expression (e.g. 'IS_KEY(user._key)').

On this page

Search results