There is such a function:
func EditAddNar(rnd render.Render, r *http.Request) { r.ParseForm() id_patient := r.FormValue("id_patient") id_vrach_ortoped := r.FormValue("id_vrach_ortoped") id_vrach_technic := r.FormValue("id_vrach_technic") number_nar := r.FormValue("number_nar") date_open_nar := r.FormValue("date_open_nar") date_start_production := r.FormValue("date_start_production") date_close_nar := r.FormValue("date_close_nar") sum := r.FormValue("sum") switch id_vrach_ortoped { case "": id_vrach_ortoped = "null" } switch id_vrach_technic { case "": id_vrach_technic = "null" } switch number_nar { case "": number_nar = "null" } switch date_open_nar { case "": date_open_nar = "null" } switch date_start_production { case "": date_start_production = "null" } switch date_close_nar { case "": date_close_nar = "null" } switch &sum { case "": sum = "null" } var query = "INSERT INTO j_nar (id_patient, id_vrach_ortoped, id_vrach_technic, number_nar, date_open_nar ,date_start_production, da te_close_nar, sum) VALUES ($1, $2, $3, $4, $5, $6, $7, $8)" models.ModelAddNar(query, id_patient, id_vrach_ortoped, id_vrach_technic, number_nar, date_open_nar, date_start_production, date_close_nar, sum) } models.ModelAddNar simply passes the request and parameters to the model, and she already executes the command. pq swears:
pq: invalid input syntax for integer: "NULL"
But if all the data from r.FormParse () were not empty, then the query is working. Tell me how to insert empty (null) values into the database.