How does go handle the err returned when operating mysql

func DBGetAdd(t string, n string, v string) map[string]string {
    sql := "insert into "+t+"("+n+") values("+v+")"
    //
    ret, err := DB.Exec(sql);
    d := map[string]string{}
        if err != nil {
            fmt.Println(err)
            fmt.Printf("%T\n",err)
            d["state"] = "error"
            d["data"] = "error"
            return d
        }
}

insert a piece of data into mysql. I want to return the contents in err and find that err is * mysql.MySQLError type. How to use err as string

Jun.22,2022

e: = fmt.Sprintf ("% s", err)

Menu