I am new to Go I just started learning it a few days ago for the concurrency :-). I have a different library that returns a time.Duration type, which has Seconds, a float64 precision value I'd like to use and store in a database.
Here are relevant bits and pieces to what I'm trying to accomplish:
type pResp struct {
address string
rtt time.Duration
sent int
recv int
}
stmt, err := db.Prepare("insert pings set domain = ?, packet_rtt = ?, packets_sent = ?, packets_recv = ?")
res, err := stmt.Exec(r.address, r.rtt.Seconds, r.sent, r.recv)
This is the error I get:
2019/08/26 19:57:35 sql: converting argument $2 type: unsupported type func() float64, a func
Process exiting with code: 0
The column in MySQL is set to double, which should be 64 bits... I am not sure where I am going wrong here. Is this a limitation of the library I am using? Thanks.