On Saturday, January 29, 2022 at 5:12:48 AM UTC+11 kimiyas...@gmail.com wrote:
> Hi > > i have a struct event and inner that i have struct RequestRecord > *type RequestRecord struct {* > * ID string `json:"id"`* > * Addr string `json:"addr"`* > * Host string `json:"host"`* > * Method string `json:"method"`* > * UserAgent string `json:"useragent"`* > *}* > *type event struct {* > * ID string `json:"id"`* > * TimeStamp string `json:"timestamp"`* > * Action string `json:"action"`* > * Length int `json:"length"`* > * Repository string `json:"repository"`* > * FromRepository string `json:"fromRepository"`* > * URL string `json:"url"`* > * Tag string `json:"tag"`* > * Request RequestRecord `json:"request"`* > *}* > > in inserting to database i get this error: > *sql: converting argument $10 type: unsupported type main.RequestRecord, a > struct* > > i attached main.go > Your code uses the `pq` driver but it is using `sqlite` db. Have you looked at using a driver for sqlite instead? such as https://github.com/mattn/go-sqlite3 Additionally, i suggest, you share your code in a way, others can run and reproduce the error so that they can try to help you and also please share the HTTP request you sent to your server which reproduces the error. If i try to build your code now, i get this: # test ./main.go:153:11: too many arguments in call to StoreItem have (*sql.DB, interface { Scan(interface {}) error; Value() (driver.Value, error) }, interface { Scan(interface {}) error; Value() (driver.Value, error) }) want (*sql.DB, []event) -- 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/e345e3f0-acfa-44a0-a74b-78275553f49en%40googlegroups.com.