Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Return an associative array of data #70

Open
chelsEg opened this issue Jul 15, 2021 · 1 comment
Open

Return an associative array of data #70

chelsEg opened this issue Jul 15, 2021 · 1 comment

Comments

@chelsEg
Copy link

chelsEg commented Jul 15, 2021

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!

@dehlirious
Copy link

dehlirious commented Mar 7, 2024

Personally, I just store a string, which is the serialized contents of my array. ( serialized(['test'=>'test'] )
Unserialize it when I grab it, and I have no issues. ( unserialize() )

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants