Datasource proxy, switch to lookup by id

This commit is contained in:
Torkel Ödegaard
2014-12-19 07:27:25 +01:00
parent a2a0e0394d
commit a7c816c65e
5 changed files with 12 additions and 13 deletions
+3 -3
View File
@@ -14,11 +14,11 @@ func init() {
bus.AddHandler("sql", AddDataSource)
bus.AddHandler("sql", DeleteDataSource)
bus.AddHandler("sql", UpdateDataSource)
bus.AddHandler("sql", GetDataSourceByName)
bus.AddHandler("sql", GetDataSourceById)
}
func GetDataSourceByName(query *m.GetDataSourceByNameQuery) error {
sess := x.Limit(100, 0).Where("account_id=? AND name=?", query.AccountId, query.Name)
func GetDataSourceById(query *m.GetDataSourceByIdQuery) error {
sess := x.Limit(100, 0).Where("account_id=? AND id=?", query.AccountId, query.Id)
has, err := sess.Get(&query.Result)
if !has {