-
Hi, I am trying to query a single value from a database or at times only inserting a single value in the database. I have tried using a variable of type of the model itself but this also does not work. I have not been able to find any documentation about this but the error coming back makes it seem like this is possible. Any ideas? In the mean time I am just querying a slice of structs and taking the last one but this feels super hacky |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
It does fail if there are no rows in the result though which is annoying. It does not just set the value in the struct to nil |
Beta Was this translation helpful? Give feedback.
var dest struct{model.Entity}
does work (still could not find the documentation about this though. I was just forgetting to pass it by reference to queryIt does fail if there are no rows in the result though which is annoying. It does not just set the value in the struct to nil