Oihana PHP Arango

aqlReturn.php

Table of Contents

Functions

aqlReturn()  : string
Builds an AQL `RETURN` clause from a given expression.

Functions

aqlReturn()

Builds an AQL `RETURN` clause from a given expression.

aqlReturn(mixed $expression[, bool $distinct = false ]) : string

A RETURN operation is mandatory at the end of each AQL query block, otherwise the query result would be undefined. Using RETURN at the top level in data modification queries is optional.

Example:

use function oihana\arango\db\operations\aqlReturn;

echo aqlReturn( 'user.name' ) . PHP_EOL;
// RETURN user.name

echo aqlReturn( Clause::NEW ) . PHP_EOL;
// RETURN NEW

echo aqlReturn( 'user.email' , true ) . PHP_EOL;
// RETURN DISTINCT user.email
Parameters
$expression : mixed

The expression to evaluate (array or string).

$distinct : bool = false

Whether to add the DISTINCT keyword in the RETURN clause.

Tags
see
https://docs.arangodb.com/stable/aql/high-level-operations/return
since
1.0.0
author

Marc Alcaraz

Return values
string

The compiled AQL RETURN clause, or an empty string if expression is empty.

On this page

Search results