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

Add support for indexing operator [ ] #65

Open
wgevaert opened this issue Jul 5, 2022 · 0 comments
Open

Add support for indexing operator [ ] #65

wgevaert opened this issue Jul 5, 2022 · 0 comments
Assignees
Labels
subject/missing-syntax Issues related to missing support for Cypher syntax type/enhancement New feature or request

Comments

@wgevaert
Copy link
Contributor

wgevaert commented Jul 5, 2022

CYPHER has the indexing operator [].

Simple examples of its use are WITH {a:'Hello World!'} AS map RETURN map['a'] and WITH ['Hello World!'] AS list RETURN list[0].

More complicated examples are WITH 2 AS a, ['a','b','Hello World!'] AS list RETURN list[a], WITH {a:'Hello World!',c:'a'} AS map RETURN map[map['c']] and
WITH ['a','Hello World!','b'] AS list, {ab:1} AS map RETURN list[map[list[0]+list[2]]]

All of these should return Hello World!

I think [] should be implemented on things of CompositeType and CompositeTypeTrait should have this implemented like ->index($index) where $index is either a string-like thing or integer-like thing. (In particular, lists only accept integers and maps only accept strings if I'm correct).

@wgevaert wgevaert added the type/enhancement New feature or request label Jul 5, 2022
@marijnvanwezel marijnvanwezel self-assigned this Jul 5, 2022
@marijnvanwezel marijnvanwezel added the subject/missing-syntax Issues related to missing support for Cypher syntax label Nov 18, 2022
@marijnvanwezel marijnvanwezel added this to the php-cypher-dsl 6.0 milestone Nov 18, 2022
@marijnvanwezel marijnvanwezel added type/enhancement New feature or request and removed type/enhancement New feature or request labels Nov 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
subject/missing-syntax Issues related to missing support for Cypher syntax type/enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants