client

package
v0.0.0-...-ac3f38b Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	// EngineStartedStatus represents a status of a running engine.
	EngineStartedStatus = "ENGINE_STATUS_RUNNING_REVISION_SERVING"
	// EngineTerminationSuccessfulStatus represents a status of a succesfully terminated engine.
	EngineTerminationSuccessfulStatus = "ENGINE_STATUS_TERMINATION_FINISHED"
	// EngineTerminationdFailedStatus represents a status of a unsuccesfully terminated engine.
	EngineTerminationdFailedStatus = "ENGINE_STATUS_TERMINATION_FAILED"

	// MetaTypeUInt8 represents an internal Firebolt's type used for boolean.
	MetaTypeUInt8 = "UInt8"
	// MetaTypeDATE represents Firebolt's type used for date.
	MetaTypeDATE = "Date"
	// MetaTypeNullableDATE represents Firebolt's type used for date with NULL constraint.
	MetaTypeNullableDATE = "Nullable(Date)"
	// MetaTypeTIMESTAMP represents Firebolt's type used for TIMESTAMP .
	MetaTypeTIMESTAMP = "DateTime"
	// MetaTypeNullableTIMESTAMP represents Firebolt's type used for TIMESTAMP with NULL constraint.
	MetaTypeNullableTIMESTAMP = "Nullable(DateTime)"
)

Variables

View Source
var (

	// ErrColumnsValuesLenMismatch occurs when trying to insert a row with a different column and value lengths.
	ErrColumnsValuesLenMismatch = errors.New("number of columns must be equal to number of values")
	// ErrCannotCastValueToFloat64 occurs when trying to cast any to float64 but it failed.
	ErrCannotCastValueToFloat64 = errors.New("cannot cast value to float64")
	// ErrCannotCastValueToString occurs when trying to cast any to string but it failed.
	ErrCannotCastValueToString = errors.New("cannot cast value to string")
	// ErrCannotParseTime occurs when trying to cast any to string but it failed.
	ErrCannotParseTime = errors.New("parse time error")
)

Functions

This section is empty.

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client for calls to firebolt.

func New

func New(ctx context.Context, dbName string) *Client

New creates new instance of the Client.

func (*Client) Close

func (c *Client) Close(_ context.Context)

Close closes the HTTP client connections.

func (*Client) GetColumnTypes

func (c *Client) GetColumnTypes(
	ctx context.Context,
	table string,
) (map[string]string, error)

GetColumnTypes get types columns.

func (*Client) GetEngineStatus

func (c *Client) GetEngineStatus(ctx context.Context) (string, error)

GetEngineStatus returns the current status of the underlying engine.

func (*Client) GetPrimaryKeys

func (c *Client) GetPrimaryKeys(
	ctx context.Context,
	table string,
) ([]string, error)

GetPrimaryKeys returns the names of primary indexes columns.

func (*Client) GetRows

func (c *Client) GetRows(
	ctx context.Context,
	table string,
	orderingColumns, columns []string,
	limit, offset int,
) ([]map[string]any, error)

GetRows get rows from table.

func (*Client) InsertRow

func (c *Client) InsertRow(ctx context.Context, table string, columns []string, values []any) error

InsertRow inserts a row into a table, with the provided columns and values.

func (*Client) Login

func (c *Client) Login(ctx context.Context, params LoginParams) error

Login logins to firebolt.

func (*Client) RefreshToken

func (c *Client) RefreshToken(ctx context.Context) error

RefreshToken performs a refresh token request. The method set the *Client.accessToken field to the new access token.

func (*Client) RunQuery

func (c *Client) RunQuery(ctx context.Context, query string) (*RunQueryResponse, error)

RunQuery runs an SQL query.

func (*Client) StartEngine

func (c *Client) StartEngine(ctx context.Context) (bool, error)

StartEngine starts a Firebolt engine and returns a bool indicating whether the engine is started or not.

func (*Client) WaitEngineStarted

func (c *Client) WaitEngineStarted(ctx context.Context) error

WaitEngineStarted periodically checks the engine status, and if the status is equal to ENGINE_STATUS_RUNNING_REVISION_SERVING or ctx is canceled returns. It's a blocking method.

type LoginParams

type LoginParams struct {
	Email       string
	Password    string
	AccountName string
	EngineName  string
}

LoginParams is an incoming params for the Login method.

type RunQueryResponse

type RunQueryResponse struct {
	Meta       []RunQueryResponseMeta     `json:"meta"`
	Data       []map[string]any           `json:"data"`
	Rows       int                        `json:"rows"`
	Statistics RunQueryResponseStatistics `json:"statistics"`
}

RunQueryResponse is a response model for run query request.

type RunQueryResponseMeta

type RunQueryResponseMeta struct {
	Name string `json:"name"`
	Type string `json:"type"`
}

RunQueryResponseMeta is a metadata used within the RunQueryResponse.

type RunQueryResponseStatistics

type RunQueryResponseStatistics struct {
	Elapsed   float64 `json:"elapsed"`
	RowsRead  int     `json:"rows_read"`
	BytesRead int     `json:"bytes_read"`
}

RunQueryResponseStatistics is a statistics used within the RunQueryResponse.

Jump to

Keyboard shortcuts

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