Documentation
¶
Index ¶
- Constants
- func NewDatasource(_ context.Context, _ backend.DataSourceInstanceSettings) (instancemgmt.Instance, error)
- func ResponseInfoMiddleware() httpclient.Middleware
- func RoundTripper(_ httpclient.Options, next http.RoundTripper) http.RoundTripper
- type ColumnDefinition
- type ColumnType
- type Datasource
- type GoogleClient
- type GoogleSheets
Constants ¶
const ( // ColumTypeTime is the TIME type ColumTypeTime ColumnType = "TIME" // ColumTypeNumber is the NUMBER type ColumTypeNumber = "NUMBER" // ColumTypeString is the STRING type ColumTypeString = "STRING" )
const ResponseInfoMiddlewareName = "response-info"
Variables ¶
This section is empty.
Functions ¶
func NewDatasource ¶ added in v1.2.0
func NewDatasource(_ context.Context, _ backend.DataSourceInstanceSettings) (instancemgmt.Instance, error)
NewDatasource creates a new Google Sheets datasource instance.
func ResponseInfoMiddleware ¶ added in v1.2.13
func ResponseInfoMiddleware() httpclient.Middleware
func RoundTripper ¶ added in v1.2.13
func RoundTripper(_ httpclient.Options, next http.RoundTripper) http.RoundTripper
Types ¶
type ColumnDefinition ¶
type ColumnDefinition struct { Header string ColumnIndex int // contains filtered or unexported fields }
ColumnDefinition represents a spreadsheet column definition.
func NewColumnDefinition ¶
func NewColumnDefinition(header string, index int) *ColumnDefinition
NewColumnDefinition creates a new ColumnDefinition.
func (*ColumnDefinition) CheckCell ¶
func (cd *ColumnDefinition) CheckCell(cell *sheets.CellData)
CheckCell checks a ColumnDefinition's cell.
func (*ColumnDefinition) GetType ¶
func (cd *ColumnDefinition) GetType() ColumnType
GetType gets the type of a ColumnDefinition.
func (*ColumnDefinition) GetUnit ¶
func (cd *ColumnDefinition) GetUnit() string
GetUnit gets the unit of a ColumnDefinition.
func (*ColumnDefinition) HasMixedTypes ¶
func (cd *ColumnDefinition) HasMixedTypes() bool
HasMixedTypes returns whether a ColumnDefinition has mixed types.
func (*ColumnDefinition) HasMixedUnits ¶
func (cd *ColumnDefinition) HasMixedUnits() bool
HasMixedUnits returns whether a ColumnDefinition has mixed units.
type Datasource ¶ added in v1.2.2
type Datasource struct { backend.CallResourceHandler // contains filtered or unexported fields }
func (*Datasource) CheckHealth ¶ added in v1.2.2
func (d *Datasource) CheckHealth(ctx context.Context, req *backend.CheckHealthRequest) (*backend.CheckHealthResult, error)
CheckHealth checks if the datasource is working.
func (*Datasource) QueryData ¶ added in v1.2.2
func (d *Datasource) QueryData(ctx context.Context, req *backend.QueryDataRequest) (*backend.QueryDataResponse, error)
QueryData handles queries to the datasource.
type GoogleClient ¶
type GoogleClient struct {
// contains filtered or unexported fields
}
GoogleClient struct
func NewGoogleClient ¶
func NewGoogleClient(ctx context.Context, settings models.DatasourceSettings) (*GoogleClient, error)
NewGoogleClient creates a new client and initializes a sheet service and a drive service
func (*GoogleClient) GetSpreadsheet ¶
func (gc *GoogleClient) GetSpreadsheet(ctx context.Context, spreadSheetID string, sheetRange string, _ bool) (*sheets.Spreadsheet, error)
GetSpreadsheet gets a google spreadsheet struct by id and range
func (*GoogleClient) GetSpreadsheetFiles ¶
func (gc *GoogleClient) GetSpreadsheetFiles() ([]*drive.File, error)
GetSpreadsheetFiles lists all files with spreadsheet mimetype that the client has access to.
func (*GoogleClient) TestClient ¶
func (gc *GoogleClient) TestClient() error
TestClient checks that the client can connect to required services
type GoogleSheets ¶
type GoogleSheets struct {
Cache *cache.Cache
}
GoogleSheets provides an interface to the Google Sheets API.
func (*GoogleSheets) GetSpreadsheets ¶
func (gs *GoogleSheets) GetSpreadsheets(ctx context.Context, config models.DatasourceSettings) (map[string]string, error)
GetSpreadsheets gets spreadsheets from the Google API.
func (*GoogleSheets) Query ¶
func (gs *GoogleSheets) Query(ctx context.Context, refID string, qm *models.QueryModel, config models.DatasourceSettings, timeRange backend.TimeRange) (dr backend.DataResponse)
Query queries a spreadsheet and returns a corresponding data frame.