Skip to content

Commit

Permalink
CreateAsset should overwrite fields on an existing match
Browse files Browse the repository at this point in the history
  • Loading branch information
vin047 committed Jul 16, 2021
1 parent 54339d5 commit 49777f1
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion database/neo_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -399,10 +399,13 @@ func (neo *Neo4j) CreateAsset(id string, assetid string, assettype string, remot
}
defer conn.Close()

fields := "memory.key = {key}, asset.type = {type}, asset.remotepath = {remotepath}, asset.remotepathorig = {remotepathorig}, asset.createdate = {createdate}, asset.location = {location}, asset.duration = {duration}, asset.originaluti = {originaluti}, asset.pixelwidth = {pixelwidth}, asset.pixelheight = {pixelheight}, asset.md5 = {md5}, asset.totalsize = {totalsize} "

stmt, err := conn.PrepareNeo(
"MATCH (user:User { id: {id} }) " +
"MERGE (user) <- [memory:MEMORY] - (asset:Asset { uuid: {assetid} }) " +
"ON CREATE SET memory.key = {key}, asset.type = {type}, asset.remotepath = {remotepath}, asset.remotepathorig = {remotepathorig}, asset.createdate = {createdate}, asset.location = {location}, asset.duration = {duration}, asset.originaluti = {originaluti}, asset.pixelwidth = {pixelwidth}, asset.pixelheight = {pixelheight}, asset.md5 = {md5}, asset.totalsize = {totalsize} ")
"ON CREATE SET " + fields +
"ON MATCH SET " + fields)
if err != nil {
return err
}
Expand Down

0 comments on commit 49777f1

Please sign in to comment.