In order to reduce the number or rows resulting from complex queries, I bundle up the results of sub queries into a Map object. I then return a collection of Map objects which can then be easily converted into Go structs. I believe that you were the one that suggested this approach to me.
OPTIONAL MATCH (f)-[:CREATED]->(a:activity)
WITH f, {
accessedrole: r.accessedrole, accessedby: r.accessedby,
createdat: a.createdat, createdby: {id: a.contactid, object: "contact"}} AS r
OPTIONAL MATCH (f)-[:HISTORY]->(a:activity)
WITH f, {
accessedrole: r.accessedrole, accessedby: r.accessedby,
createdat: r.createdat, createdby: r.createdby,
updatedat: a.createdat, updatedby: {id: a.contactid, object: "contact"}} AS r
OPTIONAL MATCH (f)-[:TAG]->(x)
WITH f, COLLECT(x) AS xs, r
WITH f, {
accessedrole: r.accessedrole, accessedby: r.accessedby,
createdat: r.createdat, createdby: r.createdby,
updatedat: r.updatedat, updatedby: r.updatedby,
tags: [x IN xs | {id: x.id, object: x.object, name: x.name}] } AS r
RETURN COLLECT({
id: f.id, object: f.object, projectid: f.projectid, no: f.no, name: f.name, description: f.description, url: f.url, mime: f.mime, thumbnail: f.thumbnail, size: f.size,
accessedrole: r.accessedrole, accessedby: r.accessedby,
createdat: r.createdat, createdby: r.createdby,
updatedat: r.updatedat, updatedby: r.updatedby,
tags: r.tags
}) AS r