谷歌是否不鼓励使用第三方Go驱动程序来使用云SQL?

huangapple go评论95阅读模式
英文:

Does Google discourage use of 3rd party Go drivers for cloud sql using?

问题

根据这个链接,有一个适用于Cloud SQL的Go库。

Google Cloud SQL on App Engine:
user@cloudsql(project-id:instance-name)/dbname

但是根据GAE网站上的说明,你可能只能(或者应该)使用Java或Python来连接Cloud SQL:https://developers.google.com/cloud-sql/faq#languages

我可以使用除了Java和Python之外的其他语言吗?
    只支持Java和Python用于Google Cloud SQL。

我正在评估GAE是否适合我的Go应用程序。Google是否不鼓励使用第三方库来连接Cloud SQL?

如果不能使用Cloud SQL,这对我来说是一个无法接受的问题,我将寻找另一个托管我的Go应用程序的平台。

英文:

According to this

There is a Go library for Cloud SQL.

Google Cloud SQL on App Engine:
user@cloudsql(project-id:instance-name)/dbname

But according the GAE site, you can (maybe should?) use only java or python to connect to Cloud SQL: https://developers.google.com/cloud-sql/faq#languages

Can I use languages other than Java or Python?
    Only Java and Python are supported for Google Cloud SQL.

I'm determining if GAE is a good fit for my Go application. Is Google discouraging the use of 3rd party libraries to connect to Cloud SQL?

Not being able to use Cloud SQL would be a deal breaker for me and will have me looking for another platform to host my Go application.

答案1

得分: 1

使用Google Cloud SQL与App Engine Go SDK的文档描述了如何使用Google Cloud SQL实例。我们想要为github.com/go-sql-driver/mysql添加对Cloud SQL的支持。你只需要让你的mysql驱动调用appengine/cloudsql包中提供的Dial函数(该函数接受一个CloudSQL实例名称并返回一个net.Conn),或者找到一种获取net.Conn的方法。你可以参考我们为ziutek的mymysql包所做的工作。你认为你会遇到什么问题呢?

英文:

> Using Google Cloud SQL with App Engine Go SDK
>
> This document describes how to use Google Cloud SQL instances with the
> App Engine Go SDK.
>
> Cloud SQL with Go-MySQL-Driver
>
> We would like to add support for Cloud SQL to
> github.com/go-sql-driver/mysql.
>
> There shouldn't be much to do. The appengine/cloudsql package 1
> provides a Dial function that takes a CloudSQL instance name and
> returns a net.Conn; you just have to arrange for your mysql driver to
> call that (or have some way of taking a net.Conn).
>
> You could follow what we did for ziutek's mymysql package 2.

Why do you think you have will have a problem?

答案2

得分: 0

我相信你可以使用第三方包,这是Go特定的App Engine API文档链接:https://developers.google.com/appengine/docs/go/cloud-sql/reference

> 应用程序应该通过database/sql来使用这个包:选择一个纯Go的MySQL驱动程序,支持这个包,并使用sql.Open函数,协议选择"cloudsql",地址为CloudSQL实例。第二个参数的确切格式取决于驱动程序,详细信息请参考驱动程序的文档。

import "database/sql"
import _ "<some mysql package>"

所以我认为"<some mysql package>"可以是https://github.com/go-sql-driver/mysql。

英文:

I belive you can use 3rd packages, here is the document in Go specific App Engine API:
https://developers.google.com/appengine/docs/go/cloud-sql/reference

> Applications should use this package through database/sql: Select a
> pure Go MySQL driver that supports this package, and use sql.Open with
> protocol "cloudsql" and an address of the CloudSQL instance. The exact
> format of the second argument to sql.Open is driver-dependent; consult
> the driver's documentation for details.

import &quot;database/sql&quot;
import _ &quot;&lt;some mysql package&gt;&quot;

So I think "<some mysql package>" can be https://github.com/go-sql-driver/mysql

huangapple
  • 本文由 发表于 2014年3月3日 09:48:32
  • 转载请务必保留本文链接:https://go.coder-hub.com/22137359.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定