Skip to content

Return an associative array of dataΒ #70

@chelsEg

Description

@chelsEg

Hello.

In our projects we use Your library for connect to Tarantool.

Would be great if select function return associative array.

At the moment in our cases we have something like this:

$result = $client()->getSpace('test_space')->select(Criteria::key([1]));

print_r($result);

/*
    Array
    (
        [0] => Array
            (
                [0] => 1
                [1] => Test
                [2] => Test
                [3] => https://www.google.com/
                [4] => 1
                [5] => 0
                [6] => 1
                [7] => 2
                [8] => 1
                [9] => 1
                [10] => 1
            )
    )
 */

After that we associate index number with field name for comfort and easy usage in our code.

Proposal:

For more comfort usage, adding boolean parameter $associative with default value => false to select function.

$result = $client()->getSpace('test_space')->select(Criteria::key([1]), true);

print_r($result);

/*
    Array
    (
        [0] => Array
        (
            [field_1] => 1
            [field_2] => Test
            [field_3] => Test
            [field_4] => https://www.google.com/
            [field_5] => 1
            [field_6] => 0
            [field_7] => 1
            [field_8] => 2
            [field_9] => 1
            [field_10] => 1
            [field_11] => 1
        )
    )
*/

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions