[ 
https://issues.apache.org/jira/browse/S2GRAPH-216?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Daewon Jeong reassigned S2GRAPH-216:
------------------------------------

    Assignee: Daewon Jeong

> Provide a transform directive in the GraphQL query result.
> ----------------------------------------------------------
>
>                 Key: S2GRAPH-216
>                 URL: https://issues.apache.org/jira/browse/S2GRAPH-216
>             Project: S2Graph
>          Issue Type: Improvement
>          Components: s2graphql
>            Reporter: Daewon Jeong
>            Assignee: Daewon Jeong
>            Priority: Minor
>
> h2. Provides a way to manipulate the String if the value of the returned 
> field is String.
> You may want to simply change the result value of the field returned by the 
> query's result value. In the case of SQL, the return field can be prefixed 
> with the string 'prefix'.
> {noformat}
>   select concat('prefix_', label) as with_prefix from labels limit 2
> {noformat}
>  
> I would like to implement the 'Directive' function provided by the GraphQL 
> Spec as follows.
> The script language used for the @transform directive is to use scala, which 
> can be changed to a language that conforms to Javascript or other JVM 
> ScriptEngine (JSR-223) specifications.
> {noformat}
> {
>   s2graph {
>     user_id_test(id: 0) {
>       s2graph_label_test_2(limit: 1) {
>         item_id_test {
>           id
>           transformedId: id @transform(func: " (s: String) => 
> s\"img_${s}_${s.toInt * 10}.jpg\" ")
>           timestamp
>         }
>       }
>     }
>   }
> }
> {noformat}
>  
> The result of the above query will be as follows.
>  You can see that the value of the 'transformedId' field has changed.
> {noformat}
> {
>   "data": {
>     "s2graph": {
>       "user_id_test": [
>         {
>           "s2graph_label_test_2": [
>             {
>               "item_id_test": {
>                 "id": "1",
>                 "transformedId": "img_1_10.jpg",
>                 "timestamp": 1527663919876
>               }
>             }
>           ]
>         }
>       ]
>     }
>   }
> }
> {noformat}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to