Google\Cloud\Datastore\Query\Query::distinctOn PHP Method

distinctOn() public method

The query results will contain the first result for each distinct combination of values for the given properties (if empty, all results are returned). Example: $query->distinctOn('lastName');
public distinctOn ( array | string $property ) : Query
$property array | string The property or properties to make distinct.
return Query
    public function distinctOn($property)
    {
        if (!is_array($property)) {
            $property = [$property];
        }
        foreach ($property as $prop) {
            $this->query['distinctOn'][] = $this->propertyName($prop);
        }
        return $this;
    }