|
|
@ -26,7 +26,6 @@ type Store interface { |
|
|
|
GetDataSource(context.Context, *datasources.GetDataSourceQuery) (*datasources.DataSource, error) |
|
|
|
GetDataSource(context.Context, *datasources.GetDataSourceQuery) (*datasources.DataSource, error) |
|
|
|
GetDataSources(context.Context, *datasources.GetDataSourcesQuery) ([]*datasources.DataSource, error) |
|
|
|
GetDataSources(context.Context, *datasources.GetDataSourcesQuery) ([]*datasources.DataSource, error) |
|
|
|
GetDataSourcesByType(context.Context, *datasources.GetDataSourcesByTypeQuery) ([]*datasources.DataSource, error) |
|
|
|
GetDataSourcesByType(context.Context, *datasources.GetDataSourcesByTypeQuery) ([]*datasources.DataSource, error) |
|
|
|
GetDefaultDataSource(context.Context, *datasources.GetDefaultDataSourceQuery) (*datasources.DataSource, error) |
|
|
|
|
|
|
|
DeleteDataSource(context.Context, *datasources.DeleteDataSourceCommand) error |
|
|
|
DeleteDataSource(context.Context, *datasources.DeleteDataSourceCommand) error |
|
|
|
AddDataSource(context.Context, *datasources.AddDataSourceCommand) (*datasources.DataSource, error) |
|
|
|
AddDataSource(context.Context, *datasources.AddDataSourceCommand) (*datasources.DataSource, error) |
|
|
|
UpdateDataSource(context.Context, *datasources.UpdateDataSourceCommand) (*datasources.DataSource, error) |
|
|
|
UpdateDataSource(context.Context, *datasources.UpdateDataSourceCommand) (*datasources.DataSource, error) |
|
|
@ -125,20 +124,6 @@ func (ss *SqlStore) GetDataSourcesByType(ctx context.Context, query *datasources |
|
|
|
}) |
|
|
|
}) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// GetDefaultDataSource is used to get the default datasource of organization
|
|
|
|
|
|
|
|
func (ss *SqlStore) GetDefaultDataSource(ctx context.Context, query *datasources.GetDefaultDataSourceQuery) (*datasources.DataSource, error) { |
|
|
|
|
|
|
|
dataSource := datasources.DataSource{} |
|
|
|
|
|
|
|
return &dataSource, ss.db.WithDbSession(ctx, func(sess *db.Session) error { |
|
|
|
|
|
|
|
exists, err := sess.Where("org_id=? AND is_default=?", query.OrgID, true).Get(&dataSource) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if !exists { |
|
|
|
|
|
|
|
return datasources.ErrDataSourceNotFound |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return err |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// DeleteDataSource removes a datasource by org_id as well as either uid (preferred), id, or name
|
|
|
|
// DeleteDataSource removes a datasource by org_id as well as either uid (preferred), id, or name
|
|
|
|
// and is added to the bus. It also removes permissions related to the datasource.
|
|
|
|
// and is added to the bus. It also removes permissions related to the datasource.
|
|
|
|
func (ss *SqlStore) DeleteDataSource(ctx context.Context, cmd *datasources.DeleteDataSourceCommand) error { |
|
|
|
func (ss *SqlStore) DeleteDataSource(ctx context.Context, cmd *datasources.DeleteDataSourceCommand) error { |
|
|
|