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 <[email protected]>: > 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 [email protected]. > 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 [email protected]. For more options, visit https://groups.google.com/d/optout.
