models

package
v0.2.0-rc1-pagination Latest Latest
Warning

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

Go to latest
Published: Feb 26, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const LimitRows = 32_000

Variables

This section is empty.

Functions

This section is empty.

Types

type CancelResponse

type CancelResponse struct {
	Success bool `json:"success"`
}

func (CancelResponse) HasError

func (r CancelResponse) HasError() error

type ExecuteRequest

type ExecuteRequest struct {
	QueryParameters map[string]any `json:"query_parameters,omitempty"`
}

type ExecuteResponse

type ExecuteResponse struct {
	ExecutionID string `json:"execution_id,omitempty"`
	State       string `json:"state,omitempty"`
}

func (ExecuteResponse) HasError

func (e ExecuteResponse) HasError() error

type Result

type Result struct {
	Metadata ResultMetadata   `json:"metadata,omitempty"`
	Rows     []map[string]any `json:"rows,omitempty"`
}

type ResultMetadata

type ResultMetadata struct {
	ColumnNames         []string `json:"column_names,omitempty"`
	ResultSetBytes      int64    `json:"result_set_bytes,omitempty"`
	RowCount            int      `json:"row_count,omitempty"`
	TotalResultSetBytes int64    `json:"total_result_set_bytes,omitempty"`
	TotalRowCount       int      `json:"total_row_count,omitempty"`
	DatapointCount      int      `json:"datapoint_count,omitempty"`
}

type ResultOptions

type ResultOptions struct {
	// request a specific page of rows
	Page *ResultPageOption
}

ResultOptions is a struct that contains options for getting a result

func (ResultOptions) ToURLValues

func (r ResultOptions) ToURLValues() url.Values

type ResultPageOption

type ResultPageOption struct {
	// we can have more than 2^32 rows, so we need to use int64 for the offset
	Offset uint64
	// assume server can't return more than 2^32 rows
	Limit uint32
}

To paginate a large result set

type ResultsResponse

type ResultsResponse struct {
	QueryID             int64      `json:"query_id"`
	State               string     `json:"state"`
	SubmittedAt         time.Time  `json:"submitted_at"`
	ExpiresAt           time.Time  `json:"expires_at"`
	ExecutionStartedAt  *time.Time `json:"execution_started_at,omitempty"`
	ExecutionEndedAt    *time.Time `json:"execution_ended_at,omitempty"`
	CancelledAt         *time.Time `json:"cancelled_at,omitempty"`
	Error               *any       `json:"error,omitempty"`
	Result              Result     `json:"result,omitempty"`
	NextOffset          *uint64    `json:"next_offset,omitempty"`
	NextURI             *string    `json:"next_uri,omitempty"`
	IsExecutionFinished bool       `json:"is_execution_finished,omitempty"`
}

func (*ResultsResponse) AddPageResult

func (r *ResultsResponse) AddPageResult(pageResp *ResultsResponse)

func (ResultsResponse) HasError

func (r ResultsResponse) HasError() error

func (ResultsResponse) IsEmpty

func (r ResultsResponse) IsEmpty() bool

type StatusResponse

type StatusResponse struct {
	ExecutionID        string          `json:"execution_id,omitempty"`
	QueryID            int             `json:"query_id,omitempty"`
	State              string          `json:"state,omitempty"`
	SubmittedAt        time.Time       `json:"submitted_at,omitempty"`
	ExecutionStartedAt *time.Time      `json:"execution_started_at,omitempty"`
	ExecutionEndedAt   *time.Time      `json:"execution_ended_at,omitempty"`
	CancelledAt        *time.Time      `json:"cancelled_at,omitempty"`
	ResultMetadata     *ResultMetadata `json:"result_metadata,omitempty"`
}

func (StatusResponse) HasError

func (s StatusResponse) HasError() error

Jump to

Keyboard shortcuts

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