Skip to content

Commit

Permalink
Expose data source list method to querier (#5400)
Browse files Browse the repository at this point in the history
  • Loading branch information
eleftherias authored Feb 3, 2025
1 parent f9b49bf commit f5f00ed
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions pkg/querier/datasource.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ import (

// DataSourceHandlers interface provides functions to interact with data sources
type DataSourceHandlers interface {
ListDataSourcesByProject(
ctx context.Context,
projectID uuid.UUID,
) ([]*pb.DataSource, error)
CreateDataSource(
ctx context.Context,
projectID uuid.UUID,
Expand All @@ -39,6 +43,17 @@ type DataSourceHandlers interface {
) error
}

// ListDataSourcesByProject returns a list of data sources by project ID
func (q *querierType) ListDataSourcesByProject(ctx context.Context, projectID uuid.UUID) ([]*pb.DataSource, error) {
if q.querier == nil {
return nil, ErrQuerierMissing
}
if q.dataSourceSvc == nil {
return nil, ErrDataSourceSvcMissing
}
return q.dataSourceSvc.List(ctx, projectID, dsservice.ReadBuilder().WithTransaction(q.querier))
}

// CreateDataSource creates a data source
func (q *querierType) CreateDataSource(
ctx context.Context,
Expand Down

0 comments on commit f5f00ed

Please sign in to comment.