Hood “config.json” 值

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

Hood "config.json" values

问题

我对hood的文档有一些问题,关于config.json中应该包含什么内容没有解释。

我尝试了以下配置:

{
  "development": {
    "driver": "postgres",
    "source": "my_development"
  }
}

但是我遇到了错误:

hood db:migrate
2014/06/23 12:53:14 应用迁移...
panic: 在连接信息字符串中的"my_development"后缺少"="号
英文:

I have some problems with documentation for hood, there no explanation about what supposed to be in config.json.
I've tried:

{
  "development": {
    "driver": "postgres",
    "source": "my_development"
  }
}

but I have the error:

hood db:migrate
2014/06/23 12:53:14 applying migrations...
panic: missing "=" after "my_development" in connection info string"

答案1

得分: 2

hood文档中:

driver和source字段是你将传递给sql.Open(2)函数的字符串。

所以driver的值应该是postgresql(对于你的示例),而source的值应该是一个key=value列表或一个完整的连接URI(如postgresql文档中所述)。

一些示例(来自这里):

  • postgres://pqgotest:password@localhost/pqgotest?sslmode=verify-full
  • user=pqgotest dbname=pqgotest sslmode=verify-full
英文:

From the hood documentation :

> The driver and source fields are the strings you would pass to the sql.Open(2) function.

So the driver value should be postgresql (for your example), and the source value should be either a list of key=value or a full connection URI (like described in the postgresql documentation).

Some examples (from here) :

  • postgres://pqgotest:password@localhost/pqgotest?sslmode=verify-full
  • user=pqgotest dbname=pqgotest sslmode=verify-full

huangapple
  • 本文由 发表于 2014年6月23日 17:19:01
  • 转载请务必保留本文链接:https://go.coder-hub.com/24362362.html
匿名

发表评论

匿名网友

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

确定