Thanks. Exactly what I needed.
On Wed, Oct 26, 2022 at 3:45 PM Konstantin Khomoutov
wrote:
> On Wed, Oct 26, 2022 at 01:38:51PM +0300, David Harel wrote:
>
> [...]
> > func errorCheckResult(err error) string {
> > if err == nil {
> > return ""
> > }
> > pqerr := err.(*pq.Erro
On Wed, Oct 26, 2022 at 01:38:51PM +0300, David Harel wrote:
[...]
> func errorCheckResult(err error) string {
> if err == nil {
> return ""
> }
> pqerr := err.(*pq.Error)
> switch pqerr.Get('C') {
> case "23505":
> return "Key violation"
> }
> return "E
Thanks for your reply.
After I submitted my question I made some progress and found that:
The infrastructure of my solution is using the pq package - import "
github.com/lib/pq"
The marshaling method is not relevant anymore.
I can analyse the error by casting to pq.Error.
Code example:
func erro
On Fri, Oct 21, 2022 at 08:17:16AM -0700, David Harel wrote:
> Newbie on golang. Using sqlc: https://github.com/kyleconroy/sqlc in the
> environment created by Karl Keefer:
> https://github.com/karlkeefer/pngr/actions/workflows/build.yml, thanks Karl.
> My queries use querier which is auto gener
Hi there,
Newbie on golang. Using sqlc: https://github.com/kyleconroy/sqlc in the
environment created by Karl Keefer:
https://github.com/karlkeefer/pngr/actions/workflows/build.yml, thanks Karl.
My queries use querier which is auto generated by sqlc.
Sometime I get an error result in my query s