Skip to content

QueryBuilder🔗

Constructor🔗

func NewQueryBuilder() *QueryBuilder

Methods🔗

Build🔗

Builds the object.

func (builder *QueryBuilder) Build() (dashboardv2beta1.DataQueryKind, error)

Datasource🔗

New type for datasource reference

Not creating a new type until we figure out how to handle DS refs for group by, adhoc, and every place that uses DataSourceRef in TS.

func (builder *QueryBuilder) Datasource(datasource cog.Builder[dashboardv2beta1.Dashboardv2beta1DataQueryKindDatasource]) *QueryBuilder

Hide🔗

If hide is set to true, Grafana will filter out the response(s) associated with this query before returning it to the panel.

func (builder *QueryBuilder) Hide(hide bool) *QueryBuilder

OldDatasource🔗

For mixed data sources the selected datasource is on the query level.

For non mixed scenarios this is undefined.

TODO find a better way to do this ^ that's friendly to schema

TODO this shouldn't be unknown but DataSourceRef | null

func (builder *QueryBuilder) OldDatasource(datasource common.DataSourceRef) *QueryBuilder

PanelId🔗

Panel ID from wich the queries will be reused.

func (builder *QueryBuilder) PanelId(panelId uint32) *QueryBuilder

QueryType🔗

Specify the query flavor

TODO make this required and give it a default

func (builder *QueryBuilder) QueryType(queryType string) *QueryBuilder

RefId🔗

A unique identifier for the query within the list of targets.

In server side expressions, the refId is used as a variable name to identify results.

By default, the UI will assign A->Z; however setting meaningful names may be useful.

func (builder *QueryBuilder) RefId(refId string) *QueryBuilder

Version🔗

func (builder *QueryBuilder) Version(version string) *QueryBuilder

WithTransforms🔗

func (builder *QueryBuilder) WithTransforms(withTransforms bool) *QueryBuilder

See also🔗