I build a social network, when a comment include mentions (like Facebook), I send a comment json to webservice:
{
"owner": 5, // id of user write comment
"message": "text",
"mentions":[
{
"id": 1, // user id
"name": "mention", // name is shown
"offset": 0, // position of start of mention text
"length": 10 // length of mention text
},
{
"id": 2, // user id
"name": "mention", // name is shown
"offset": 0, // position of start of mention text
"length": 10 // length of mention text
}
],
}
DATA MODEL: (User)-[WRITE]->(Comment{message})-[MENTION{name,offset,length}]->(User)
In source code, I use below code to return res with ID of comment
cq := neoism.CypherQuery{
Statement: stmt,
Parameters: params,
Result: &res,
}
My problem is I don't know how to write query for this. Too hard for me.
Here is how to do the Cypher without breaking apart the json first.