models

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Jun 12, 2026 License: MIT Imports: 7 Imported by: 2 modules, 8 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const LimitRows = 32_000

Variables

This section is empty.

Functions

This section is empty.

Types

type ArchiveDashboardResponse added in v0.4.8

type ArchiveDashboardResponse struct {
	OK          bool  `json:"ok"`
	DashboardID int64 `json:"dashboard_id"`
}

type BillingPeriod added in v0.3.0

type BillingPeriod struct {
	StartDate       string  `json:"start_date"`
	EndDate         string  `json:"end_date"`
	CreditsUsed     float64 `json:"credits_used"`
	CreditsIncluded int     `json:"credits_included"`
}

type CancelResponse

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

func (CancelResponse) HasError

func (r CancelResponse) HasError() error

type CreateDashboardRequest added in v0.4.8

type CreateDashboardRequest struct {
	Name             string            `json:"name"`
	IsPrivate        *bool             `json:"is_private,omitempty"`
	VisualizationIDs []int64           `json:"visualization_ids,omitempty"`
	TextWidgets      []TextWidgetInput `json:"text_widgets,omitempty"`
	ColumnsPerRow    *int32            `json:"columns_per_row,omitempty"`
}

type CreateQueryRequest added in v0.4.0

type CreateQueryRequest struct {
	Name        string           `json:"name"`
	QuerySQL    string           `json:"query_sql"`
	Description string           `json:"description,omitempty"`
	IsPrivate   bool             `json:"is_private,omitempty"`
	IsTemp      bool             `json:"is_temp,omitempty"`
	Parameters  []QueryParameter `json:"parameters,omitempty"`
}

type CreateQueryResponse added in v0.4.0

type CreateQueryResponse struct {
	QueryID int `json:"query_id"`
}

type CreateVisualizationRequest added in v0.4.6

type CreateVisualizationRequest struct {
	QueryID     int            `json:"query_id"`
	Name        string         `json:"name"`
	Type        string         `json:"type"`
	Description string         `json:"description,omitempty"`
	Options     map[string]any `json:"options,omitempty"`
}

type CreateVisualizationResponse added in v0.4.6

type CreateVisualizationResponse struct {
	ID int64 `json:"id"`
}

type DashboardResponse added in v0.4.8

type DashboardResponse struct {
	DashboardID          int64                       `json:"dashboard_id"`
	Name                 string                      `json:"name"`
	Slug                 string                      `json:"slug"`
	IsPrivate            bool                        `json:"is_private"`
	Tags                 []string                    `json:"tags"`
	DashboardURL         string                      `json:"dashboard_url"`
	VisualizationWidgets []VisualizationWidgetOutput `json:"visualization_widgets"`
	TextWidgets          []TextWidgetOutput          `json:"text_widgets"`
	ParamWidgets         []ParamWidgetOutput         `json:"param_widgets"`
}

type DatasetColumn added in v0.3.0

type DatasetColumn struct {
	Name        string         `json:"name"`
	Type        string         `json:"type"`
	Nullable    bool           `json:"nullable"`
	Description string         `json:"description,omitempty"`
	Metadata    map[string]any `json:"metadata,omitempty"`
}

type DatasetOwner added in v0.3.0

type DatasetOwner struct {
	Handle string `json:"handle"`
	Type   string `json:"type"`
}

type DatasetResponse added in v0.3.0

type DatasetResponse struct {
	Type      string          `json:"type"`
	FullName  string          `json:"full_name"`
	IsPrivate bool            `json:"is_private"`
	Columns   []DatasetColumn `json:"columns"`
	Owner     *DatasetOwner   `json:"owner"`
	Metadata  map[string]any  `json:"metadata,omitempty"`
	CreatedAt string          `json:"created_at"`
	UpdatedAt string          `json:"updated_at"`
}

func (DatasetResponse) HasError added in v0.3.0

func (d DatasetResponse) HasError() error

type DeleteMaterializedViewResponse added in v0.5.0

type DeleteMaterializedViewResponse struct {
	Message string `json:"message"`
}

type DeleteVisualizationResponse added in v0.4.7

type DeleteVisualizationResponse struct {
	OK bool `json:"ok"`
}

type ExecuteRequest

type ExecuteRequest struct {
	QueryID         int            `json:"-"`
	QueryParameters map[string]any `json:"query_parameters,omitempty"`
	Performance     string         `json:"performance,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 ExecuteSQLRequest added in v0.3.0

type ExecuteSQLRequest struct {
	SQL             string         `json:"sql"`
	Performance     string         `json:"performance,omitempty"`
	QueryParameters map[string]any `json:"query_parameters,omitempty"`
}

type ExecutionError added in v0.3.0

type ExecutionError struct {
	Type     string                 `json:"type"`
	Message  string                 `json:"message"`
	Metadata map[string]interface{} `json:"metadata,omitempty"`
}

type GetMaterializedViewResponse added in v0.5.0

type GetMaterializedViewResponse struct {
	// ID and the owner fields are only populated for Dune-team API keys.
	ID               string   `json:"id,omitempty"`
	SQLID            string   `json:"sql_id"`
	OwnerUserID      *int     `json:"owner_user_id,omitempty"`
	OwnerTeamID      *int     `json:"owner_team_id,omitempty"`
	QueryID          int      `json:"query_id"`
	IsPrivate        bool     `json:"is_private"`
	LastExecutionIDs []string `json:"last_execution_ids"`
	TableSizeBytes   int64    `json:"table_size_bytes"`
	// Schedule is nil when the materialized view has no scheduled refresh.
	Schedule *MaterializedViewSchedule `json:"schedule,omitempty"`
}

type GetQueryResponse added in v0.4.0

type GetQueryResponse struct {
	QueryID     int              `json:"query_id"`
	Name        string           `json:"name"`
	Description string           `json:"description"`
	QuerySQL    string           `json:"query_sql"`
	Owner       string           `json:"owner"`
	IsPrivate   bool             `json:"is_private"`
	IsArchived  bool             `json:"is_archived"`
	IsUnsaved   bool             `json:"is_unsaved"`
	IsTemp      bool             `json:"is_temp"`
	Version     int              `json:"version"`
	QueryEngine string           `json:"query_engine"`
	Tags        []string         `json:"tags"`
	Parameters  []QueryParameter `json:"parameters"`
}

type GetVisualizationResponse added in v0.4.7

type GetVisualizationResponse struct {
	ID          int64          `json:"id"`
	QueryID     int64          `json:"query_id"`
	Name        string         `json:"name"`
	Description string         `json:"description"`
	Type        string         `json:"type"`
	Options     map[string]any `json:"options"`
	CreatedAt   string         `json:"created_at"`
	UpdatedAt   string         `json:"updated_at"`
}

type ListDatasetsResponse added in v0.3.0

type ListDatasetsResponse struct {
	Datasets []DatasetResponse `json:"datasets"`
	Total    int               `json:"total"`
}

func (ListDatasetsResponse) HasError added in v0.3.0

func (l ListDatasetsResponse) HasError() error

type ListMaterializedViewsResponse added in v0.5.0

type ListMaterializedViewsResponse struct {
	MaterializedViews []*MaterializedViewListElement `json:"materialized_views"`
	// NextOffset is 0 when there are no further pages.
	NextOffset int32 `json:"next_offset"`
}

type ListVisualizationsResponse added in v0.4.7

type ListVisualizationsResponse struct {
	Results    []VisualizationSummary `json:"results"`
	TotalCount int32                  `json:"total_count"`
}

type MaterializedViewListElement added in v0.5.0

type MaterializedViewListElement struct {
	ID             string `json:"id"`
	SQLID          string `json:"sql_id"`
	QueryID        int    `json:"query_id"`
	IsPrivate      bool   `json:"is_private"`
	TableSizeBytes int64  `json:"table_size_bytes"`
}

type MaterializedViewSchedule added in v0.5.0

type MaterializedViewSchedule struct {
	CronExpression    string  `json:"cron_expression"`
	Performance       string  `json:"performance,omitempty"`
	NextExecutionTime *string `json:"next_execution_time,omitempty"`
	ExpiresAt         *string `json:"expires_at,omitempty"`
}

type ParamWidgetInput added in v0.4.8

type ParamWidgetInput struct {
	Key                   string          `json:"key"`
	QueryID               int64           `json:"query_id"`
	VisualizationWidgetID int64           `json:"visualization_widget_id"`
	Position              *WidgetPosition `json:"position,omitempty"`
}

type ParamWidgetOutput added in v0.4.8

type ParamWidgetOutput struct {
	WidgetID              string         `json:"widget_id"`
	Key                   string         `json:"key"`
	QueryID               int64          `json:"query_id"`
	VisualizationWidgetID int64          `json:"visualization_widget_id"`
	Position              WidgetPosition `json:"position"`
}

type PipelineExecuteRequest added in v0.3.0

type PipelineExecuteRequest struct {
	QueryID     string `json:"-"`
	Performance string `json:"performance,omitempty"`
}

type PipelineExecuteResponse added in v0.3.0

type PipelineExecuteResponse struct {
	PipelineExecutionID string `json:"pipeline_execution_id,omitempty"`
}

type PipelineNodeExecution added in v0.3.0

type PipelineNodeExecution struct {
	ID                   int                          `json:"id,omitempty"`
	QueryExecutionStatus PipelineQueryExecutionStatus `json:"query_execution_status,omitempty"`
}

type PipelineQueryExecutionStatus added in v0.3.0

type PipelineQueryExecutionStatus struct {
	Status      string `json:"status,omitempty"`
	QueryID     int    `json:"query_id,omitempty"`
	ExecutionID string `json:"execution_id,omitempty"`
}

type PipelineStatusResponse added in v0.3.0

type PipelineStatusResponse struct {
	Status         string                  `json:"status,omitempty"`
	NodeExecutions []PipelineNodeExecution `json:"node_executions,omitempty"`
}

type QueryParameter added in v0.4.0

type QueryParameter struct {
	Key         string   `json:"key"`
	Type        string   `json:"type"`
	Value       string   `json:"value"`
	EnumOptions []string `json:"enumOptions,omitempty"`
}

type RefreshMaterializedViewRequest added in v0.5.0

type RefreshMaterializedViewRequest struct {
	Performance string `json:"performance,omitempty"`
}

type RefreshMaterializedViewResponse added in v0.5.0

type RefreshMaterializedViewResponse struct {
	SQLID       string `json:"sql_id"`
	ExecutionID string `json:"execution_id"`
}

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               *ExecutionError `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 SearchDatasetMetadata added in v0.4.1

type SearchDatasetMetadata struct {
	PageRankScore *float64        `json:"page_rank_score,omitempty"`
	Description   *string         `json:"description,omitempty"`
	AbiType       *string         `json:"abi_type,omitempty"`
	ContractName  *string         `json:"contract_name,omitempty"`
	ProjectName   *string         `json:"project_name,omitempty"`
	SpellType     *string         `json:"spell_type,omitempty"`
	SpellMetadata json.RawMessage `json:"spell_metadata,omitempty"`
}

type SearchDatasetResult added in v0.4.1

type SearchDatasetResult struct {
	FullName    string                 `json:"full_name"`
	Category    string                 `json:"category"`
	DatasetType *string                `json:"dataset_type,omitempty"`
	Blockchains []string               `json:"blockchains,omitempty"`
	Visibility  *string                `json:"visibility,omitempty"`
	OwnerScope  *string                `json:"owner_scope,omitempty"`
	Description *string                `json:"description,omitempty"`
	Schema      json.RawMessage        `json:"schema,omitempty"`
	Metadata    *SearchDatasetMetadata `json:"metadata,omitempty"`
}

type SearchDatasetsByContractAddressRequest added in v0.4.3

type SearchDatasetsByContractAddressRequest struct {
	ContractAddress string   `json:"contract_address"`
	Blockchains     []string `json:"blockchains,omitempty"`
	Limit           *int32   `json:"limit,omitempty"`
	Offset          *int32   `json:"offset,omitempty"`
	IncludeSchema   *bool    `json:"include_schema,omitempty"`
}

type SearchDatasetsPagination added in v0.4.1

type SearchDatasetsPagination struct {
	Limit      int32  `json:"limit"`
	Offset     int32  `json:"offset"`
	NextOffset *int32 `json:"next_offset,omitempty"`
	HasMore    bool   `json:"has_more"`
}

type SearchDatasetsRequest added in v0.4.1

type SearchDatasetsRequest struct {
	Query           *string  `json:"query,omitempty"`
	Categories      []string `json:"categories,omitempty"`
	Blockchains     []string `json:"blockchains,omitempty"`
	DatasetTypes    []string `json:"dataset_types,omitempty"`
	Schemas         []string `json:"schemas,omitempty"`
	OwnerScope      *string  `json:"owner_scope,omitempty"`
	IncludePrivate  *bool    `json:"include_private,omitempty"`
	IncludeSchema   *bool    `json:"include_schema,omitempty"`
	IncludeMetadata *bool    `json:"include_metadata,omitempty"`
	Limit           *int32   `json:"limit,omitempty"`
	Offset          *int32   `json:"offset,omitempty"`
}

type SearchDatasetsResponse added in v0.4.1

type SearchDatasetsResponse struct {
	Total      int32                    `json:"total"`
	Results    []SearchDatasetResult    `json:"results"`
	Pagination SearchDatasetsPagination `json:"pagination"`
}

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"`
	Error              *ExecutionError `json:"error,omitempty"`
	ResultMetadata     *ResultMetadata `json:"result_metadata,omitempty"`
}

func (StatusResponse) HasError

func (s StatusResponse) HasError() error

type TextWidgetInput added in v0.4.8

type TextWidgetInput struct {
	Text     string          `json:"text"`
	Position *WidgetPosition `json:"position,omitempty"`
}

type TextWidgetOutput added in v0.4.8

type TextWidgetOutput struct {
	WidgetID int64          `json:"widget_id"`
	Text     string         `json:"text"`
	Position WidgetPosition `json:"position"`
}

type UpdateDashboardRequest added in v0.4.8

type UpdateDashboardRequest struct {
	Name                 *string                     `json:"name,omitempty"`
	Slug                 *string                     `json:"slug,omitempty"`
	IsPrivate            *bool                       `json:"is_private,omitempty"`
	Tags                 *[]string                   `json:"tags,omitempty"`
	VisualizationWidgets *[]VisualizationWidgetInput `json:"visualization_widgets,omitempty"`
	TextWidgets          *[]TextWidgetInput          `json:"text_widgets,omitempty"`
	ParamWidgets         *[]ParamWidgetInput         `json:"param_widgets,omitempty"`
	ColumnsPerRow        *int32                      `json:"columns_per_row,omitempty"`
}

type UpdateQueryRequest added in v0.4.0

type UpdateQueryRequest struct {
	Name        *string          `json:"name,omitempty"`
	QuerySQL    *string          `json:"query_sql,omitempty"`
	Description *string          `json:"description,omitempty"`
	IsPrivate   *bool            `json:"is_private,omitempty"`
	IsArchived  *bool            `json:"is_archived,omitempty"`
	Tags        []string         `json:"tags,omitempty"`
	Parameters  []QueryParameter `json:"parameters,omitempty"`
}

type UpdateQueryResponse added in v0.4.0

type UpdateQueryResponse struct {
	QueryID int `json:"query_id"`
}

type UpdateVisualizationRequest added in v0.4.7

type UpdateVisualizationRequest struct {
	Name        string         `json:"name"`
	Type        string         `json:"type"`
	Description string         `json:"description"`
	Options     map[string]any `json:"options"`
}

type UpdateVisualizationResponse added in v0.4.7

type UpdateVisualizationResponse struct {
	ID int64 `json:"id"`
}

type UploadsCSVRequest added in v0.3.0

type UploadsCSVRequest struct {
	TableName   string `json:"table_name"`
	Data        string `json:"data"`
	Description string `json:"description,omitempty"`
	IsPrivate   bool   `json:"is_private,omitempty"`
}

type UploadsCSVResponse added in v0.3.0

type UploadsCSVResponse struct {
	Success      bool   `json:"success"`
	TableName    string `json:"table_name"`
	FullName     string `json:"full_name"`
	ExampleQuery string `json:"example_query"`
}

type UploadsClearResponse added in v0.3.0

type UploadsClearResponse struct {
	Message string `json:"message"`
}

type UploadsColumn added in v0.3.0

type UploadsColumn struct {
	Name        string         `json:"name"`
	Type        string         `json:"type"`
	Nullable    bool           `json:"nullable"`
	Metadata    map[string]any `json:"metadata,omitempty"`
	Description string         `json:"description,omitempty"`
}

type UploadsCreateRequest added in v0.3.0

type UploadsCreateRequest struct {
	Namespace   string          `json:"namespace"`
	TableName   string          `json:"table_name"`
	Schema      []UploadsColumn `json:"schema"`
	Description string          `json:"description,omitempty"`
	IsPrivate   bool            `json:"is_private,omitempty"`
}

type UploadsCreateResponse added in v0.3.0

type UploadsCreateResponse struct {
	Namespace      string `json:"namespace"`
	TableName      string `json:"table_name"`
	FullName       string `json:"full_name"`
	ExampleQuery   string `json:"example_query"`
	AlreadyExisted bool   `json:"already_existed"`
	Message        string `json:"message"`
}

type UploadsDeleteResponse added in v0.3.0

type UploadsDeleteResponse struct {
	Message string `json:"message"`
}

type UploadsInsertResponse added in v0.3.0

type UploadsInsertResponse struct {
	Name         string `json:"name"`
	RowsWritten  int64  `json:"rows_written"`
	BytesWritten int64  `json:"bytes_written"`
}

type UploadsListElement added in v0.3.0

type UploadsListElement struct {
	FullName       string          `json:"full_name"`
	IsPrivate      bool            `json:"is_private"`
	TableSizeBytes string          `json:"table_size_bytes"`
	CreatedAt      time.Time       `json:"created_at"`
	UpdatedAt      time.Time       `json:"updated_at"`
	PurgedAt       *time.Time      `json:"purged_at,omitempty"`
	Owner          UploadsOwner    `json:"owner"`
	Columns        []UploadsColumn `json:"columns"`
}

type UploadsListResponse added in v0.3.0

type UploadsListResponse struct {
	Tables []UploadsListElement `json:"tables"`
}

type UploadsOwner added in v0.3.0

type UploadsOwner struct {
	Handle string `json:"handle"`
	Type   string `json:"type"`
}

type UpsertMaterializedViewRequest added in v0.5.0

type UpsertMaterializedViewRequest struct {
	Name           string  `json:"name"`
	QueryID        int     `json:"query_id"`
	IsPrivate      bool    `json:"is_private"`
	Performance    string  `json:"performance,omitempty"`
	CronExpression *string `json:"cron_expression,omitempty"`
	ExpiresAt      *string `json:"expires_at,omitempty"`
}

type UpsertMaterializedViewResponse added in v0.5.0

type UpsertMaterializedViewResponse struct {
	// SQLID is the fully-qualified SQL name of the materialized view (e.g. dune.my_team.result_x).
	SQLID       string `json:"name"`
	ExecutionID string `json:"execution_id"`
}

type UsageRequest added in v0.3.0

type UsageRequest struct {
	StartDate *string `json:"start_date,omitempty"`
	EndDate   *string `json:"end_date,omitempty"`
}

type UsageResponse added in v0.3.0

type UsageResponse struct {
	PrivateQueries    int             `json:"private_queries"`
	PrivateDashboards int             `json:"private_dashboards"`
	BytesUsed         int64           `json:"bytes_used"`
	BytesAllowed      int64           `json:"bytes_allowed"`
	BillingPeriods    []BillingPeriod `json:"billing_periods"`
}

type VisualizationSummary added in v0.4.7

type VisualizationSummary struct {
	ID        int64  `json:"id"`
	Name      string `json:"name"`
	Type      string `json:"type"`
	CreatedAt string `json:"created_at"`
	UpdatedAt string `json:"updated_at"`
}

type VisualizationWidgetInput added in v0.4.8

type VisualizationWidgetInput struct {
	VisualizationID int64           `json:"visualization_id"`
	Position        *WidgetPosition `json:"position,omitempty"`
}

type VisualizationWidgetOutput added in v0.4.8

type VisualizationWidgetOutput struct {
	WidgetID        int64          `json:"widget_id"`
	VisualizationID int64          `json:"visualization_id"`
	Position        WidgetPosition `json:"position"`
}

type WhoAmIResponse added in v0.4.4

type WhoAmIResponse struct {
	CustomerID string `json:"customer_id"` // e.g. "user_123" or "team_456"
	CreatedBy  int    `json:"created_by"`  // integer user ID of the key creator
	APIKeyID   string `json:"api_key_id"`  // ULID of the API key
	Handle     string `json:"handle"`      // username or team handle
}

WhoAmIResponse represents the response from the /api/whoami endpoint. It identifies the user or team associated with the current API key.

type WidgetPosition added in v0.4.8

type WidgetPosition struct {
	Row   int32 `json:"row"`
	Col   int32 `json:"col"`
	SizeX int32 `json:"size_x"`
	SizeY int32 `json:"size_y"`
}

Widget position in the dashboard grid

Jump to

Keyboard shortcuts

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