gin gonic – How to unmarshall Go struct field of type map[string]interface-ThrowExceptions

Exception or error: I am trying to unmarshall multidimensional JSON. My JSON is contains dynamic key therefore I can’t do it. JSON { “id”:”3″, “datetime”:”2019-06-08″, “metadata”:[{“a”:”A”},{“b”:”B”}] } Go file type Chats struct { Id string json:”id” Datetime string json:”date” Metadata string json:”metadata” } chat := models.Chats{} err := c.BindJSON(&chat) if err != nil { c.Error(err) …

go – Cannot use args (type []string) as type []interface {}-ThrowExceptions

Exception or error: This question already has answers here: Type converting slices of interfaces (6 answers) Closed 6 months ago. my golang sqlite insert function. i’m using this package “github.com/mattn/go-sqlite3” func Insert(args …string)(err error){ db, err:=sql.Open(“sqlite3″,”sqlite.db”) if err !=nil { return } q, err := db.Prepare(args[0]) if err !=nil{ return } _,err = q.Exec(args[1:]…) return …

go – How to parse QueryString-ThrowExceptions

Exception or error: I have a string such as username=Test1234&currency=THB and I need to get value of username or currency qry, _ := url.Parse(string(qryString)) How to solve: An example is as follows: package main import ( “fmt” “net/url” ) func main() { address := “http://example.com?name=poloxue&age=11” u, err := url.Parse(address) if err != nil { panic(err) …