Using raw db connection for creating object #721

Open
opened 2017-09-12 21:37:07 +00:00 by snktagarwal · 1 comment
snktagarwal commented 2017-09-12 21:37:07 +00:00 (Migrated from github.com)

Hi Xorm team,

Firstly thanks for writing this awesome ORM tool! Golang is still in its initial stages so its good to see some mature code out there!

I am using Google's Cloud offering and they have a CloudSql proxy (which talks mysql internally). Although since your constructor does not take an actual db object (and say that it's SQL) I cannot use xorm unless I deconstruct either yours or cloudsql proxy code.

This is how I currently instantiate an object in my code:

config.Addr = instanceName config.User = dbUser config.Passwd = dbPass config.DBName = dbName db, err = cloudsqldialer.DialCfg(&config)

The code for cloudsql is here: github.com/GoogleCloudPlatform/cloudsql-proxy

Any help appreciated

Hi Xorm team, Firstly thanks for writing this awesome ORM tool! Golang is still in its initial stages so its good to see some mature code out there! I am using Google's Cloud offering and they have a CloudSql proxy (which talks mysql internally). Although since your constructor does not take an actual db object (and say that it's SQL) I cannot use xorm unless I deconstruct either yours or cloudsql proxy code. This is how I currently instantiate an object in my code: ` config.Addr = instanceName config.User = dbUser config.Passwd = dbPass config.DBName = dbName db, err = cloudsqldialer.DialCfg(&config) ` The code for cloudsql is here: github.com/GoogleCloudPlatform/cloudsql-proxy Any help appreciated

I think maybe you can copy mysql dialect and change something to do that. XORM needs to know the SQL syntax which you are using, MySQL or Postgres. So a raw *DB is not enough. But if XORM know the raw *DB and the it's MySQL syntax it will work. But it also has some work to do.

I think maybe you can copy mysql dialect and change something to do that. XORM needs to know the SQL syntax which you are using, MySQL or Postgres. So a raw *DB is not enough. But if XORM know the raw *DB and the it's MySQL syntax it will work. But it also has some work to do.
Sign in to join this conversation.
No Milestone
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: xorm/xorm#721
No description provided.