googlesheets

package
v1.2.8 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 19, 2024 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ColumTypeTime is the TIME type
	ColumTypeTime ColumnType = "TIME"
	// ColumTypeNumber is the NUMBER type
	ColumTypeNumber = "NUMBER"
	// ColumTypeString is the STRING type
	ColumTypeString = "STRING"
)

Variables

This section is empty.

Functions

func NewDatasource added in v1.2.0

NewDatasource creates a new Google Sheets datasource instance.

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 ColumnType

type ColumnType string

ColumnType is the set of possible column types

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

CheckHealth checks if the datasource is working.

func (*Datasource) QueryData added in v1.2.2

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(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

Query queries a spreadsheet and returns a corresponding data frame.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL