Hi Henrik, Thanks for the reply. I do see that code in marshal.go in my gocql repo. So I should be having this specific PR.
case TypeDate: return unmarshalDate(info, data, value) case TypeDate: return marshalDate(info, value) And the corresponding func implementations are also there. Still I dont understand how/why it is falling into the last code block // TODO(tux21b): add the remaining types return nil, fmt.Errorf("can not marshal %T into %s", value, info) Regards Raju On Wednesday, April 11, 2018 at 12:51:33 AM UTC-7, Henrik Johansson wrote: > > There is a PR for `date` marshalling > https://github.com/gocql/gocql/pull/878 that is merged March last year. > If you have gocql older than that I suggest trying to update but I am not > sure if it helps. > > Timestamp/time.Time has always worked very well for me though so if you > can switch that could be an option. > > > > ons 11 apr. 2018 kl 09:17 skrev Raju <rman...@gmail.com <javascript:>>: > >> I have a table in cassandra which looks like this: >> >> create table dailyusage( >> name string >> service string >> date date >> ); >> >> >> I need to write a query in Go using gocql package to filter the results >> from dailyusage table based on a user provided date range >> >> I have created my query like this >> >> startDate := "2018-04-01" >> endDate := "2018-04-03" >> >> var name, service string >> var date time.Time >> >> qstr := `SELECT name, service, date, FROM dailyusage WHERE date >= ? and >> date <= ?` >> >> iter := ss.Query(qstr, startDate, endDate).Iter() >> >> >> for iter.Scan(&name, &service, &date) { >> >> // add to my list >> >> } >> >> >> if err := iter.Close(); err != nil { >> >> fmt.Printf("Error closing iterator:%v \n", err) >> >> } >> >> >> When I run this, I am getting error - >> >> Error closing iterator. Error:can not marshal string into date >> >> >> >> If I change startDate and endDate to time.Time format, I am getting this >> below error >> >> Error closing iterator. Error:can not marshal time.Time into date >> >> Is there any way to address this conversion from string/Time in golang to >> date format in cql/gocql? >> >> >> Thanks >> >> Raju >> >> >> >> >> >> -- >> 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...@googlegroups.com <javascript:>. >> For more options, visit https://groups.google.com/d/optout. >> > -- 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. For more options, visit https://groups.google.com/d/optout.