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 such as key violation. I want to check the error code of such an error. as one of the guys suggested I can look into the object using Marshal and I noticed that the error contains a very elaborated, like: {"Severity":"ERROR","Code":"23505","Message":"duplicate key value violates unique constraint \"treatment_pk\"","Detail":"Key (customer_id, patient_ttz, therapist_id, appointment_timestamp)=(1, 060525649, 160, 2022-10-20 10:30:00) already exists.","Hint":"","Position":"","InternalPosition":"","InternalQuery":"","Where":"","Schema":"public","Table":"treatment","Column":"","DataTypeName":"","Constraint":"treatment_pk","File":"nbtinsert.c","Line":"434","Routine":"_bt_check_unique"} Trying to get the same result using straight forward approach like: fmt.Printf("%+v\n", err) gives me a much simpler object display. How can I get the "smart" content of the error object like the "Code" member? Sorry to ask such a trivial question. Unfortunately for my, I was unable to find an answer yet. Thanks. -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/aeda952a-c18f-4aa2-8aa9-9a8caf72cfbfn%40googlegroups.com.