CLI: Add datasource:info command
Describes the full datasource details given an account and datasource name.
This commit is contained in:
@@ -15,6 +15,7 @@ func init() {
|
||||
bus.AddHandler("sql", DeleteDataSource)
|
||||
bus.AddHandler("sql", UpdateDataSource)
|
||||
bus.AddHandler("sql", GetDataSourceById)
|
||||
bus.AddHandler("sql", GetDataSourceByName)
|
||||
}
|
||||
|
||||
func GetDataSourceById(query *m.GetDataSourceByIdQuery) error {
|
||||
@@ -27,6 +28,16 @@ func GetDataSourceById(query *m.GetDataSourceByIdQuery) error {
|
||||
return err
|
||||
}
|
||||
|
||||
func GetDataSourceByName(query *m.GetDataSourceByNameQuery) error {
|
||||
sess := x.Limit(100, 0).Where("account_id=? AND name=?", query.AccountId, query.Name)
|
||||
has, err := sess.Get(&query.Result)
|
||||
|
||||
if !has {
|
||||
return m.ErrDataSourceNotFound
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
func GetDataSources(query *m.GetDataSourcesQuery) error {
|
||||
sess := x.Limit(100, 0).Where("account_id=?", query.AccountId).Asc("name")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user