fix issue 1481. correctly escape api_key.key column name

'key' is a reserved word in mysql. So when building a query,
the api-key.key column name needs to be escaped
This commit is contained in:
woodsaj 2015-02-13 21:52:56 +08:00
parent 6263ec1d38
commit 55ba8ad0c4

View File

@ -66,7 +66,7 @@ func UpdateApiKey(cmd *m.UpdateApiKeyCommand) error {
func GetApiKeyByKey(query *m.GetApiKeyByKeyQuery) error {
var apikey m.ApiKey
has, err := x.Where("key=?", query.Key).Get(&apikey)
has, err := x.Where("`key`=?", query.Key).Get(&apikey)
if err != nil {
return err