Here's my code (works fine with gin)
query :=`
UPDATE posts SET liked_by = uniq(array_append(liked_by, $1))
WHERE id = $2
RETURNING liked_by`
return p.DB.Exec(query, userID, post.ID)
The error I'm getting
pq: function uniq(integer[]) does not exist
My code works fine without uniq()
. But the array is taking duplicate values. I wanna make sure my array only contains unique values.