ra0o0f / arangoclient.net

ArangoDB .NET Client with LINQ support
Apache License 2.0
99 stars 37 forks source link

Ternary operator support #132

Open Alan5142 opened 5 years ago

Alan5142 commented 5 years ago

Hi, i have the following query

var users = db.Query<User>().Select(u => new User()
            {
                Birthday = u.PublicBasicInfo? u.Birthday : null,
                Email = u.PublicBasicInfo? u.Email : null,
                Id = u.Id,
                Name = u.Name,
                PublicBasicInfo= u.PublicBasicInfo
            });

but it throws

ArangoDB.Client.ArangoServerException: AQL: syntax error, unexpected identifier, expecting } near '`.`birthday`  @P1  ,  `email` : ...' at position 1:92 (while parsing). ErrorNumber: 1501 HttpStatusCode: 400

also, the previous LINQ query produces the next query:

 for `u` in `users`  return   {  `birthday` :   `u`.`publicBasicInfo`  `u`.`birthday`  @P1  ,  `email` :   `u`.`publicBasicInfo`  `u`.`email`  @P2  ,  `_key` :   `u`.`_key`  ,  `username` :   `u`.`username`  ,  `publicBasicInfo` :   `u`.`publicBasicInfo`  } 

is there a way to execute the previous query without using a raw query?