how to use vitess go client api with gorm

550 views
Skip to first unread message

coding-sunny

unread,
Feb 23, 2017, 10:25:44 PM2/23/17
to vitess
hi,
   Vitess does provide go client api,http://vitess.io/user-guide/client-libraries.html,the user guide state that vitess's go client api conform to database/sql package.Now,i have deploy a vitess cluster,and want to access by ORM framework GORM.Does vitess support GORM? If support,please provide a code example.
   TKS.

coding-sunny

unread,
Feb 24, 2017, 2:32:20 AM2/24/17
to vitess
hi,
   I have found that it's use "github.com/youtube/vitess/go/vt/vitessdriver" to conform to database/sql,and successfully retrieve data from vitess,but when retrieve a column which data type is datetime,error occurs:
   sql: Scan error on column index 10: unsupported Scan, storing driver.Value type []uint8 into type *time.Time
   It seems wrong when convert database datetime to golang time.Time.
   TKS.
 

在 2017年2月24日星期五 UTC+8上午11:25:44,coding-sunny写道:

coding-sunny

unread,
Feb 24, 2017, 2:35:29 AM2/24/17
to vitess
hi,
   I found that the php pdo client api is ok when retrieve vitess datetime column data.

在 2017年2月24日星期五 UTC+8下午3:32:20,coding-sunny写道:

coding-sunny

unread,
Feb 24, 2017, 2:40:11 AM2/24/17
to vitess
hi,
   i also found that the github.com/go-sql-driver/mysql package has a connection parameter named parseTime to deal with datetime conversion.Can vitess go client api provide such parameter too?
  TKS.
在 2017年2月24日星期五 UTC+8上午11:25:44,coding-sunny写道:
hi,

Sugu Sougoumarane

unread,
Feb 24, 2017, 4:20:25 PM2/24/17
to vitess
Hi there,

We have an open issue about the time.Time for the go driver: https://github.com/youtube/vitess/issues/2306. Till it's fixed, you can still send and receive time using the string representation.

As for other driver options, they're all available. MySQL protocol is under development and will be available very soon.

--
You received this message because you are subscribed to the Google Groups "vitess" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vitess+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages