ast

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jan 15, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package ast defines the abstract syntax tree for ClickHouse SQL.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AliasedExpr

type AliasedExpr struct {
	Position token.Position `json:"-"`
	Expr     Expression     `json:"expr"`
	Alias    string         `json:"alias"`
}

AliasedExpr represents an expression with an alias.

func (*AliasedExpr) End

func (a *AliasedExpr) End() token.Position

func (*AliasedExpr) Pos

func (a *AliasedExpr) Pos() token.Position

type AlterCommand

type AlterCommand struct {
	Position          token.Position     `json:"-"`
	Type              AlterCommandType   `json:"type"`
	Column            *ColumnDeclaration `json:"column,omitempty"`
	ColumnName        string             `json:"column_name,omitempty"`
	AfterColumn       string             `json:"after_column,omitempty"`
	NewName           string             `json:"new_name,omitempty"`
	IfNotExists       bool               `json:"if_not_exists,omitempty"`
	IfExists          bool               `json:"if_exists,omitempty"`
	Index             string             `json:"index,omitempty"`
	IndexExpr         Expression         `json:"index_expr,omitempty"`
	IndexType         string             `json:"index_type,omitempty"`
	IndexDef          *IndexDefinition   `json:"index_def,omitempty"` // For ADD INDEX with full definition
	Granularity       int                `json:"granularity,omitempty"`
	AfterIndex        string             `json:"after_index,omitempty"` // For ADD INDEX ... AFTER name
	Constraint        *Constraint        `json:"constraint,omitempty"`
	ConstraintName    string             `json:"constraint_name,omitempty"`
	Partition         Expression         `json:"partition,omitempty"`
	PartitionIsID     bool               `json:"partition_is_id,omitempty"` // True when using PARTITION ID 'value' syntax
	IsPart            bool               `json:"-"`                         // True for PART (not PARTITION) - output directly without Partition wrapper
	FromTable         string             `json:"from_table,omitempty"`
	ToDatabase        string             `json:"to_database,omitempty"` // For MOVE PARTITION TO TABLE
	ToTable           string             `json:"to_table,omitempty"`    // For MOVE PARTITION TO TABLE
	FromPath          string             `json:"from_path,omitempty"`   // For FETCH PARTITION FROM
	TTL               *TTLClause         `json:"ttl,omitempty"`
	Settings          []*SettingExpr     `json:"settings,omitempty"`
	Where             Expression         `json:"where,omitempty"`              // For DELETE WHERE
	Assignments       []*Assignment      `json:"assignments,omitempty"`        // For UPDATE
	Projection        *Projection        `json:"projection,omitempty"`         // For ADD PROJECTION
	ProjectionName    string             `json:"projection_name,omitempty"`    // For DROP/MATERIALIZE/CLEAR PROJECTION
	StatisticsColumns []string           `json:"statistics_columns,omitempty"` // For ADD/DROP/CLEAR/MATERIALIZE STATISTICS
	StatisticsTypes   []*FunctionCall    `json:"statistics_types,omitempty"`   // For ADD/MODIFY STATISTICS TYPE
	Comment           string             `json:"comment,omitempty"`            // For COMMENT COLUMN
	OrderByExpr       []Expression       `json:"order_by_expr,omitempty"`      // For MODIFY ORDER BY
	SampleByExpr      Expression         `json:"sample_by_expr,omitempty"`     // For MODIFY SAMPLE BY
	ResetSettings     []string           `json:"reset_settings,omitempty"`     // For MODIFY COLUMN ... RESET SETTING
	Query             Statement          `json:"query,omitempty"`              // For MODIFY QUERY
}

AlterCommand represents an ALTER command.

func (*AlterCommand) End

func (a *AlterCommand) End() token.Position

func (*AlterCommand) Pos

func (a *AlterCommand) Pos() token.Position

type AlterCommandType

type AlterCommandType string

AlterCommandType represents the type of ALTER command.

const (
	AlterAddColumn             AlterCommandType = "ADD_COLUMN"
	AlterDropColumn            AlterCommandType = "DROP_COLUMN"
	AlterModifyColumn          AlterCommandType = "MODIFY_COLUMN"
	AlterRenameColumn          AlterCommandType = "RENAME_COLUMN"
	AlterClearColumn           AlterCommandType = "CLEAR_COLUMN"
	AlterMaterializeColumn     AlterCommandType = "MATERIALIZE_COLUMN"
	AlterCommentColumn         AlterCommandType = "COMMENT_COLUMN"
	AlterAddIndex              AlterCommandType = "ADD_INDEX"
	AlterDropIndex             AlterCommandType = "DROP_INDEX"
	AlterClearIndex            AlterCommandType = "CLEAR_INDEX"
	AlterMaterializeIndex      AlterCommandType = "MATERIALIZE_INDEX"
	AlterAddConstraint         AlterCommandType = "ADD_CONSTRAINT"
	AlterDropConstraint        AlterCommandType = "DROP_CONSTRAINT"
	AlterModifyTTL             AlterCommandType = "MODIFY_TTL"
	AlterMaterializeTTL        AlterCommandType = "MATERIALIZE_TTL"
	AlterRemoveTTL             AlterCommandType = "REMOVE_TTL"
	AlterModifySetting         AlterCommandType = "MODIFY_SETTING"
	AlterResetSetting          AlterCommandType = "RESET_SETTING"
	AlterDropPartition         AlterCommandType = "DROP_PARTITION"
	AlterDropDetachedPartition AlterCommandType = "DROP_DETACHED_PARTITION"
	AlterDetachPartition       AlterCommandType = "DETACH_PARTITION"
	AlterAttachPartition       AlterCommandType = "ATTACH_PARTITION"
	AlterReplacePartition      AlterCommandType = "REPLACE_PARTITION"
	AlterFetchPartition        AlterCommandType = "FETCH_PARTITION"
	AlterMovePartition         AlterCommandType = "MOVE_PARTITION"
	AlterFreezePartition       AlterCommandType = "FREEZE_PARTITION"
	AlterFreeze                AlterCommandType = "FREEZE"
	AlterApplyPatches          AlterCommandType = "APPLY_PATCHES"
	AlterDeleteWhere           AlterCommandType = "DELETE_WHERE"
	AlterUpdate                AlterCommandType = "UPDATE"
	AlterAddProjection         AlterCommandType = "ADD_PROJECTION"
	AlterDropProjection        AlterCommandType = "DROP_PROJECTION"
	AlterMaterializeProjection AlterCommandType = "MATERIALIZE_PROJECTION"
	AlterClearProjection       AlterCommandType = "CLEAR_PROJECTION"
	AlterAddStatistics         AlterCommandType = "ADD_STATISTICS"
	AlterModifyStatistics      AlterCommandType = "MODIFY_STATISTICS"
	AlterDropStatistics        AlterCommandType = "DROP_STATISTICS"
	AlterClearStatistics       AlterCommandType = "CLEAR_STATISTICS"
	AlterMaterializeStatistics AlterCommandType = "MATERIALIZE_STATISTICS"
	AlterModifyComment         AlterCommandType = "MODIFY_COMMENT"
	AlterModifyOrderBy         AlterCommandType = "MODIFY_ORDER_BY"
	AlterModifySampleBy        AlterCommandType = "MODIFY_SAMPLE_BY"
	AlterModifyQuery           AlterCommandType = "MODIFY_QUERY"
	AlterRemoveSampleBy        AlterCommandType = "REMOVE_SAMPLE_BY"
	AlterApplyDeletedMask      AlterCommandType = "APPLY_DELETED_MASK"
)

type AlterNamedCollectionQuery

type AlterNamedCollectionQuery struct {
	Position token.Position `json:"-"`
	Name     string         `json:"name,omitempty"`
}

AlterNamedCollectionQuery represents an ALTER NAMED COLLECTION statement.

func (*AlterNamedCollectionQuery) End

func (*AlterNamedCollectionQuery) Pos

type AlterQuery

type AlterQuery struct {
	Position  token.Position  `json:"-"`
	Database  string          `json:"database,omitempty"`
	Table     string          `json:"table"`
	Commands  []*AlterCommand `json:"commands"`
	OnCluster string          `json:"on_cluster,omitempty"`
	Settings  []*SettingExpr  `json:"settings,omitempty"`
	Format    string          `json:"format,omitempty"` // For FORMAT clause
}

AlterQuery represents an ALTER statement.

func (*AlterQuery) End

func (a *AlterQuery) End() token.Position

func (*AlterQuery) Pos

func (a *AlterQuery) Pos() token.Position

type AlterSettingsProfileQuery

type AlterSettingsProfileQuery struct {
	Position token.Position `json:"-"`
	Names    []string       `json:"names,omitempty"`
}

AlterSettingsProfileQuery represents an ALTER SETTINGS PROFILE statement.

func (*AlterSettingsProfileQuery) End

func (*AlterSettingsProfileQuery) Pos

type ArrayAccess

type ArrayAccess struct {
	Position token.Position `json:"-"`
	Array    Expression     `json:"array"`
	Index    Expression     `json:"index"`
}

ArrayAccess represents array element access.

func (*ArrayAccess) End

func (a *ArrayAccess) End() token.Position

func (*ArrayAccess) Pos

func (a *ArrayAccess) Pos() token.Position

type ArrayJoinClause

type ArrayJoinClause struct {
	Position token.Position `json:"-"`
	Left     bool           `json:"left,omitempty"`
	Columns  []Expression   `json:"columns"`
}

ArrayJoinClause represents an ARRAY JOIN clause.

func (*ArrayJoinClause) End

func (a *ArrayJoinClause) End() token.Position

func (*ArrayJoinClause) Pos

func (a *ArrayJoinClause) Pos() token.Position

type Assignment

type Assignment struct {
	Position token.Position `json:"-"`
	Column   string         `json:"column"`
	Value    Expression     `json:"value"`
}

Assignment represents a column assignment in UPDATE.

func (*Assignment) End

func (a *Assignment) End() token.Position

func (*Assignment) Pos

func (a *Assignment) Pos() token.Position

type Asterisk

type Asterisk struct {
	Position     token.Position       `json:"-"`
	Table        string               `json:"table,omitempty"`        // for table.*
	Except       []string             `json:"except,omitempty"`       // for * EXCEPT (col1, col2) - deprecated, use Transformers
	Replace      []*ReplaceExpr       `json:"replace,omitempty"`      // for * REPLACE (expr AS col) - deprecated, use Transformers
	Apply        []string             `json:"apply,omitempty"`        // for * APPLY (func1) APPLY(func2) - deprecated, use Transformers
	Transformers []*ColumnTransformer `json:"transformers,omitempty"` // ordered list of transformers
}

Asterisk represents a *.

func (*Asterisk) End

func (a *Asterisk) End() token.Position

func (*Asterisk) Pos

func (a *Asterisk) Pos() token.Position

type AttachQuery

type AttachQuery struct {
	Position                  token.Position       `json:"-"`
	IfNotExists               bool                 `json:"if_not_exists,omitempty"`
	Database                  string               `json:"database,omitempty"`
	Table                     string               `json:"table,omitempty"`
	Dictionary                string               `json:"dictionary,omitempty"`
	FromPath                  string               `json:"from_path,omitempty"` // FROM 'path' clause
	Columns                   []*ColumnDeclaration `json:"columns,omitempty"`
	ColumnsPrimaryKey         []Expression         `json:"columns_primary_key,omitempty"`           // PRIMARY KEY in column list
	HasEmptyColumnsPrimaryKey bool                 `json:"has_empty_columns_primary_key,omitempty"` // TRUE if PRIMARY KEY () was seen with empty parens
	Indexes                   []*IndexDefinition   `json:"indexes,omitempty"`                       // INDEX definitions in column list
	Engine                    *EngineClause        `json:"engine,omitempty"`
	OrderBy                   []Expression         `json:"order_by,omitempty"`
	PrimaryKey                []Expression         `json:"primary_key,omitempty"`
	IsMaterializedView        bool                 `json:"is_materialized_view,omitempty"`
	UUID                      string               `json:"uuid,omitempty"`       // UUID clause
	InnerUUID                 string               `json:"inner_uuid,omitempty"` // TO INNER UUID clause
	PartitionBy               Expression           `json:"partition_by,omitempty"`
	SelectQuery               Statement            `json:"select_query,omitempty"` // AS SELECT clause
	Settings                  []*SettingExpr       `json:"settings,omitempty"`     // SETTINGS clause
}

AttachQuery represents an ATTACH statement.

func (*AttachQuery) End

func (a *AttachQuery) End() token.Position

func (*AttachQuery) Pos

func (a *AttachQuery) Pos() token.Position

type BackupQuery

type BackupQuery struct {
	Position   token.Position `json:"-"`
	Database   string         `json:"database,omitempty"`
	Table      string         `json:"table,omitempty"`
	Dictionary string         `json:"dictionary,omitempty"`
	All        bool           `json:"all,omitempty"` // BACKUP ALL
	Temporary  bool           `json:"temporary,omitempty"`
	Target     *FunctionCall  `json:"target,omitempty"` // Disk('path') or Null
	Settings   []*SettingExpr `json:"settings,omitempty"`
	Format     string         `json:"format,omitempty"`
}

BackupQuery represents a BACKUP statement.

func (*BackupQuery) End

func (b *BackupQuery) End() token.Position

func (*BackupQuery) Pos

func (b *BackupQuery) Pos() token.Position

type BetweenExpr

type BetweenExpr struct {
	Position token.Position `json:"-"`
	Expr     Expression     `json:"expr"`
	Not      bool           `json:"not,omitempty"`
	Low      Expression     `json:"low"`
	High     Expression     `json:"high"`
}

BetweenExpr represents a BETWEEN expression.

func (*BetweenExpr) End

func (b *BetweenExpr) End() token.Position

func (*BetweenExpr) Pos

func (b *BetweenExpr) Pos() token.Position

type BinaryExpr

type BinaryExpr struct {
	Position      token.Position `json:"-"`
	Left          Expression     `json:"left"`
	Op            string         `json:"op"`
	Right         Expression     `json:"right"`
	Parenthesized bool           `json:"parenthesized,omitempty"` // True if wrapped in explicit parentheses
}

BinaryExpr represents a binary expression.

func (*BinaryExpr) End

func (b *BinaryExpr) End() token.Position

func (*BinaryExpr) Pos

func (b *BinaryExpr) Pos() token.Position

type CaseExpr

type CaseExpr struct {
	Position    token.Position `json:"-"`
	Operand     Expression     `json:"operand,omitempty"` // for CASE x WHEN ...
	Whens       []*WhenClause  `json:"whens"`
	Else        Expression     `json:"else,omitempty"`
	Alias       string         `json:"alias,omitempty"`
	QuotedAlias bool           `json:"quoted_alias,omitempty"` // true if alias was double-quoted
}

CaseExpr represents a CASE expression.

func (*CaseExpr) End

func (c *CaseExpr) End() token.Position

func (*CaseExpr) Pos

func (c *CaseExpr) Pos() token.Position

type CastExpr

type CastExpr struct {
	Position       token.Position `json:"-"`
	Expr           Expression     `json:"expr"`
	Type           *DataType      `json:"type,omitempty"`
	TypeExpr       Expression     `json:"type_expr,omitempty"` // For dynamic type like CAST(x, if(cond, 'Type1', 'Type2'))
	Alias          string         `json:"alias,omitempty"`
	OperatorSyntax bool           `json:"operator_syntax,omitempty"` // true if using :: syntax
	UsedASSyntax   bool           `json:"-"`                         // true if CAST(x AS Type) syntax used (not CAST(x, 'Type'))
}

CastExpr represents a CAST expression.

func (*CastExpr) End

func (c *CastExpr) End() token.Position

func (*CastExpr) Pos

func (c *CastExpr) Pos() token.Position

type CheckQuery

type CheckQuery struct {
	Position  token.Position `json:"-"`
	Database  string         `json:"database,omitempty"`
	Table     string         `json:"table"`
	Partition Expression     `json:"partition,omitempty"`
	Part      Expression     `json:"part,omitempty"`
	Format    string         `json:"format,omitempty"`
	Settings  []*SettingExpr `json:"settings,omitempty"`
}

CheckQuery represents a CHECK TABLE statement.

func (*CheckQuery) End

func (c *CheckQuery) End() token.Position

func (*CheckQuery) Pos

func (c *CheckQuery) Pos() token.Position

type CodecExpr

type CodecExpr struct {
	Position token.Position  `json:"-"`
	Codecs   []*FunctionCall `json:"codecs"`
}

CodecExpr represents a CODEC expression.

func (*CodecExpr) End

func (c *CodecExpr) End() token.Position

func (*CodecExpr) Pos

func (c *CodecExpr) Pos() token.Position

type ColumnDeclaration

type ColumnDeclaration struct {
	Position    token.Position  `json:"-"`
	Name        string          `json:"name"`
	Type        *DataType       `json:"type"`
	Nullable    *bool           `json:"nullable,omitempty"`
	Default     Expression      `json:"default,omitempty"`
	DefaultKind string          `json:"default_kind,omitempty"` // DEFAULT, MATERIALIZED, ALIAS, EPHEMERAL
	Codec       *CodecExpr      `json:"codec,omitempty"`
	Statistics  []*FunctionCall `json:"statistics,omitempty"` // STATISTICS clause
	TTL         Expression      `json:"ttl,omitempty"`
	PrimaryKey  bool            `json:"primary_key,omitempty"` // PRIMARY KEY constraint
	Comment     string          `json:"comment,omitempty"`
	Settings    []*SettingExpr  `json:"settings,omitempty"` // Column-level SETTINGS
}

ColumnDeclaration represents a column definition.

func (*ColumnDeclaration) End

func (c *ColumnDeclaration) End() token.Position

func (*ColumnDeclaration) Pos

func (c *ColumnDeclaration) Pos() token.Position

type ColumnTransformer

type ColumnTransformer struct {
	Position    token.Position `json:"-"`
	Type        string         `json:"type"`                   // "apply", "except", "replace"
	Apply       string         `json:"apply,omitempty"`        // function name for APPLY
	ApplyParams []Expression   `json:"apply_params,omitempty"` // parameters for parameterized APPLY functions like quantiles(0.5)
	ApplyLambda Expression     `json:"apply_lambda,omitempty"` // lambda expression for APPLY x -> expr
	Except      []string       `json:"except,omitempty"`       // column names for EXCEPT
	Pattern     string         `json:"pattern,omitempty"`      // regex pattern for EXCEPT('pattern')
	Replaces    []*ReplaceExpr `json:"replaces,omitempty"`     // replacement expressions for REPLACE
}

ColumnTransformer represents a single transformer (APPLY, EXCEPT, or REPLACE) in order.

type ColumnsMatcher

type ColumnsMatcher struct {
	Position     token.Position       `json:"-"`
	Pattern      string               `json:"pattern,omitempty"`
	Columns      []Expression         `json:"columns,omitempty"`      // For COLUMNS(id, name) syntax
	Except       []string             `json:"except,omitempty"`       // for EXCEPT (col1, col2) - deprecated, use Transformers
	Replace      []*ReplaceExpr       `json:"replace,omitempty"`      // for REPLACE (expr AS col) - deprecated, use Transformers
	Apply        []string             `json:"apply,omitempty"`        // for APPLY (func1) APPLY(func2) - deprecated, use Transformers
	Qualifier    string               `json:"qualifier,omitempty"`    // For qualified matchers like table.COLUMNS(...)
	Transformers []*ColumnTransformer `json:"transformers,omitempty"` // ordered list of transformers
}

ColumnsMatcher represents COLUMNS('pattern') or COLUMNS(col1, col2) expression. When Pattern is set, it's a regex matcher (ColumnsRegexpMatcher in explain). When Columns is set, it's a list matcher (ColumnsListMatcher in explain).

func (*ColumnsMatcher) End

func (c *ColumnsMatcher) End() token.Position

func (*ColumnsMatcher) Pos

func (c *ColumnsMatcher) Pos() token.Position

type Constraint

type Constraint struct {
	Position   token.Position `json:"-"`
	Name       string         `json:"name,omitempty"`
	Expression Expression     `json:"expression"`
}

Constraint represents a table constraint.

func (*Constraint) End

func (c *Constraint) End() token.Position

func (*Constraint) Pos

func (c *Constraint) Pos() token.Position

type CreateIndexQuery

type CreateIndexQuery struct {
	Position             token.Position `json:"-"`
	IndexName            string         `json:"index_name"`
	Table                string         `json:"table"`
	Columns              []Expression   `json:"columns,omitempty"`
	ColumnsParenthesized bool           `json:"columns_parenthesized,omitempty"` // True if columns in (...)
	Type                 string         `json:"type,omitempty"`                  // Index type (minmax, bloom_filter, etc.)
	Granularity          int            `json:"granularity,omitempty"`           // GRANULARITY value
}

CreateIndexQuery represents a CREATE INDEX statement.

func (*CreateIndexQuery) End

func (c *CreateIndexQuery) End() token.Position

func (*CreateIndexQuery) Pos

func (c *CreateIndexQuery) Pos() token.Position

type CreateNamedCollectionQuery

type CreateNamedCollectionQuery struct {
	Position token.Position `json:"-"`
	Name     string         `json:"name,omitempty"`
}

CreateNamedCollectionQuery represents a CREATE NAMED COLLECTION statement.

func (*CreateNamedCollectionQuery) End

func (*CreateNamedCollectionQuery) Pos

type CreateQuery

type CreateQuery struct {
	Position                  token.Position                    `json:"-"`
	OrReplace                 bool                              `json:"or_replace,omitempty"`
	IfNotExists               bool                              `json:"if_not_exists,omitempty"`
	Temporary                 bool                              `json:"temporary,omitempty"`
	Database                  string                            `json:"database,omitempty"`
	Table                     string                            `json:"table,omitempty"`
	View                      string                            `json:"view,omitempty"`
	Materialized              bool                              `json:"materialized,omitempty"`
	WindowView                bool                              `json:"window_view,omitempty"`      // WINDOW VIEW type
	InnerEngine               *EngineClause                     `json:"inner_engine,omitempty"`     // INNER ENGINE for window views
	ToDatabase                string                            `json:"to_database,omitempty"`      // Target database for materialized views
	To                        string                            `json:"to,omitempty"`               // Target table for materialized views
	Populate                  bool                              `json:"populate,omitempty"`         // POPULATE for materialized views
	HasRefresh                bool                              `json:"has_refresh,omitempty"`      // Has REFRESH clause
	RefreshType               string                            `json:"refresh_type,omitempty"`     // AFTER or EVERY
	RefreshInterval           Expression                        `json:"refresh_interval,omitempty"` // Interval value
	RefreshUnit               string                            `json:"refresh_unit,omitempty"`     // SECOND, MINUTE, etc.
	RefreshAppend             bool                              `json:"refresh_append,omitempty"`   // APPEND TO was specified
	Empty                     bool                              `json:"empty,omitempty"`            // EMPTY keyword was specified
	Columns                   []*ColumnDeclaration              `json:"columns,omitempty"`
	Indexes                   []*IndexDefinition                `json:"indexes,omitempty"`
	Projections               []*Projection                     `json:"projections,omitempty"`
	Constraints               []*Constraint                     `json:"constraints,omitempty"`
	ColumnsPrimaryKey         []Expression                      `json:"columns_primary_key,omitempty"`           // PRIMARY KEY in column list
	HasEmptyColumnsPrimaryKey bool                              `json:"has_empty_columns_primary_key,omitempty"` // TRUE if PRIMARY KEY () was seen with empty parens
	Engine                    *EngineClause                     `json:"engine,omitempty"`
	OrderBy                   []Expression                      `json:"order_by,omitempty"`
	OrderByHasModifiers       bool                              `json:"order_by_has_modifiers,omitempty"` // True if ORDER BY has ASC/DESC modifiers
	PartitionBy               Expression                        `json:"partition_by,omitempty"`
	PrimaryKey                []Expression                      `json:"primary_key,omitempty"`
	SampleBy                  Expression                        `json:"sample_by,omitempty"`
	TTL                       *TTLClause                        `json:"ttl,omitempty"`
	Settings                  []*SettingExpr                    `json:"settings,omitempty"`
	QuerySettings             []*SettingExpr                    `json:"query_settings,omitempty"`          // Query-level SETTINGS (second SETTINGS clause)
	SettingsBeforeComment     bool                              `json:"settings_before_comment,omitempty"` // True if SETTINGS comes before COMMENT
	AsSelect                  Statement                         `json:"as_select,omitempty"`
	AsTableFunction           Expression                        `json:"as_table_function,omitempty"` // AS table_function(...) in CREATE TABLE
	CloneAs                   string                            `json:"clone_as,omitempty"`          // CLONE AS source_table in CREATE TABLE
	Comment                   string                            `json:"comment,omitempty"`
	OnCluster                 string                            `json:"on_cluster,omitempty"`
	CreateDatabase            bool                              `json:"create_database,omitempty"`
	CreateFunction            bool                              `json:"create_function,omitempty"`
	CreateUser                bool                              `json:"create_user,omitempty"`
	AlterUser                 bool                              `json:"alter_user,omitempty"`
	HasAuthenticationData     bool                              `json:"has_authentication_data,omitempty"`
	AuthenticationValues      []string                          `json:"authentication_values,omitempty"` // Password/hash values from IDENTIFIED BY
	SSHKeyCount               int                               `json:"ssh_key_count,omitempty"`         // Number of SSH keys for ssh_key auth
	CreateDictionary          bool                              `json:"create_dictionary,omitempty"`
	DictionaryAttrs           []*DictionaryAttributeDeclaration `json:"dictionary_attrs,omitempty"`
	DictionaryDef             *DictionaryDefinition             `json:"dictionary_def,omitempty"`
	FunctionName              string                            `json:"function_name,omitempty"`
	FunctionBody              Expression                        `json:"function_body,omitempty"`
	UserName                  string                            `json:"user_name,omitempty"`
	Format                    string                            `json:"format,omitempty"` // For FORMAT clause
}

CreateQuery represents a CREATE statement.

func (*CreateQuery) End

func (c *CreateQuery) End() token.Position

func (*CreateQuery) Pos

func (c *CreateQuery) Pos() token.Position

type CreateQuotaQuery

type CreateQuotaQuery struct {
	Position token.Position `json:"-"`
	Name     string         `json:"name,omitempty"`
}

CreateQuotaQuery represents a CREATE QUOTA statement.

func (*CreateQuotaQuery) End

func (c *CreateQuotaQuery) End() token.Position

func (*CreateQuotaQuery) Pos

func (c *CreateQuotaQuery) Pos() token.Position

type CreateResourceQuery

type CreateResourceQuery struct {
	Position token.Position `json:"-"`
	Name     string         `json:"name"`
}

CreateResourceQuery represents a CREATE RESOURCE statement.

func (*CreateResourceQuery) End

func (*CreateResourceQuery) Pos

type CreateRoleQuery

type CreateRoleQuery struct {
	Position token.Position `json:"-"`
	IsAlter  bool           `json:"is_alter,omitempty"`
}

CreateRoleQuery represents a CREATE ROLE or ALTER ROLE statement.

func (*CreateRoleQuery) End

func (c *CreateRoleQuery) End() token.Position

func (*CreateRoleQuery) Pos

func (c *CreateRoleQuery) Pos() token.Position

type CreateRowPolicyQuery

type CreateRowPolicyQuery struct {
	Position token.Position `json:"-"`
	IsAlter  bool           `json:"is_alter,omitempty"`
}

CreateRowPolicyQuery represents a CREATE ROW POLICY or ALTER ROW POLICY statement.

func (*CreateRowPolicyQuery) End

func (*CreateRowPolicyQuery) Pos

type CreateSettingsProfileQuery

type CreateSettingsProfileQuery struct {
	Position token.Position `json:"-"`
	Names    []string       `json:"names,omitempty"`
}

CreateSettingsProfileQuery represents a CREATE SETTINGS PROFILE statement.

func (*CreateSettingsProfileQuery) End

func (*CreateSettingsProfileQuery) Pos

type CreateWorkloadQuery

type CreateWorkloadQuery struct {
	Position token.Position `json:"-"`
	Name     string         `json:"name"`
	Parent   string         `json:"parent,omitempty"` // Parent workload name (after IN)
}

CreateWorkloadQuery represents a CREATE WORKLOAD statement.

func (*CreateWorkloadQuery) End

func (*CreateWorkloadQuery) Pos

type DataType

type DataType struct {
	Position       token.Position `json:"-"`
	Name           string         `json:"name"`
	Parameters     []Expression   `json:"parameters,omitempty"`
	HasParentheses bool           `json:"has_parentheses,omitempty"`
}

DataType represents a data type.

func (*DataType) End

func (d *DataType) End() token.Position

func (*DataType) Pos

func (d *DataType) Pos() token.Position

type DeleteQuery

type DeleteQuery struct {
	Position  token.Position `json:"-"`
	Database  string         `json:"database,omitempty"`
	Table     string         `json:"table"`
	OnCluster string         `json:"on_cluster,omitempty"` // ON CLUSTER clause
	Partition Expression     `json:"partition,omitempty"`  // IN PARTITION clause
	Where     Expression     `json:"where,omitempty"`
	Settings  []*SettingExpr `json:"settings,omitempty"`
}

DeleteQuery represents a lightweight DELETE statement.

func (*DeleteQuery) End

func (d *DeleteQuery) End() token.Position

func (*DeleteQuery) Pos

func (d *DeleteQuery) Pos() token.Position

type DescribeQuery

type DescribeQuery struct {
	Position      token.Position   `json:"-"`
	Database      string           `json:"database,omitempty"`
	Table         string           `json:"table,omitempty"`
	TableFunction *FunctionCall    `json:"table_function,omitempty"`
	TableExpr     *TableExpression `json:"table_expr,omitempty"` // For DESCRIBE (SELECT ...)
	Settings      []*SettingExpr   `json:"settings,omitempty"`
	Format        string           `json:"format,omitempty"`
}

DescribeQuery represents a DESCRIBE statement.

func (*DescribeQuery) End

func (d *DescribeQuery) End() token.Position

func (*DescribeQuery) Pos

func (d *DescribeQuery) Pos() token.Position

type DetachQuery

type DetachQuery struct {
	Position   token.Position `json:"-"`
	Database   string         `json:"database,omitempty"`
	Table      string         `json:"table,omitempty"`
	Dictionary string         `json:"dictionary,omitempty"`
}

DetachQuery represents a DETACH statement.

func (*DetachQuery) End

func (d *DetachQuery) End() token.Position

func (*DetachQuery) Pos

func (d *DetachQuery) Pos() token.Position

type DictionaryAttributeDeclaration

type DictionaryAttributeDeclaration struct {
	Position     token.Position `json:"-"`
	Name         string         `json:"name"`
	Type         *DataType      `json:"type"`
	Default      Expression     `json:"default,omitempty"`
	Expression   Expression     `json:"expression,omitempty"`   // EXPRESSION clause
	Hierarchical bool           `json:"hierarchical,omitempty"` // HIERARCHICAL flag
	Injective    bool           `json:"injective,omitempty"`    // INJECTIVE flag
	IsObjectID   bool           `json:"is_object_id,omitempty"` // IS_OBJECT_ID flag
}

DictionaryAttributeDeclaration represents a dictionary attribute definition.

func (*DictionaryAttributeDeclaration) End

func (*DictionaryAttributeDeclaration) Pos

type DictionaryDefinition

type DictionaryDefinition struct {
	Position   token.Position      `json:"-"`
	PrimaryKey []Expression        `json:"primary_key,omitempty"`
	Source     *DictionarySource   `json:"source,omitempty"`
	Lifetime   *DictionaryLifetime `json:"lifetime,omitempty"`
	Layout     *DictionaryLayout   `json:"layout,omitempty"`
	Range      *DictionaryRange    `json:"range,omitempty"`
	Settings   []*SettingExpr      `json:"settings,omitempty"`
}

DictionaryDefinition represents the definition part of a dictionary (PRIMARY KEY, SOURCE, LIFETIME, LAYOUT).

func (*DictionaryDefinition) End

func (*DictionaryDefinition) Pos

type DictionaryLayout

type DictionaryLayout struct {
	Position token.Position  `json:"-"`
	Type     string          `json:"type"` // e.g., "FLAT", "HASHED", "COMPLEX_KEY_HASHED"
	Args     []*KeyValuePair `json:"args,omitempty"`
}

DictionaryLayout represents the LAYOUT clause of a dictionary.

func (*DictionaryLayout) End

func (d *DictionaryLayout) End() token.Position

func (*DictionaryLayout) Pos

func (d *DictionaryLayout) Pos() token.Position

type DictionaryLifetime

type DictionaryLifetime struct {
	Position token.Position `json:"-"`
	Min      Expression     `json:"min,omitempty"`
	Max      Expression     `json:"max,omitempty"`
}

DictionaryLifetime represents the LIFETIME clause of a dictionary.

func (*DictionaryLifetime) End

func (*DictionaryLifetime) Pos

type DictionaryRange

type DictionaryRange struct {
	Position token.Position `json:"-"`
	Min      Expression     `json:"min,omitempty"`
	Max      Expression     `json:"max,omitempty"`
}

DictionaryRange represents the RANGE clause of a dictionary.

func (*DictionaryRange) End

func (d *DictionaryRange) End() token.Position

func (*DictionaryRange) Pos

func (d *DictionaryRange) Pos() token.Position

type DictionarySource

type DictionarySource struct {
	Position token.Position  `json:"-"`
	Type     string          `json:"type"` // e.g., "CLICKHOUSE", "MYSQL", "FILE"
	Args     []*KeyValuePair `json:"args,omitempty"`
}

DictionarySource represents the SOURCE clause of a dictionary.

func (*DictionarySource) End

func (d *DictionarySource) End() token.Position

func (*DictionarySource) Pos

func (d *DictionarySource) Pos() token.Position

type DropNamedCollectionQuery

type DropNamedCollectionQuery struct {
	Position token.Position `json:"-"`
	Name     string         `json:"name,omitempty"`
	IfExists bool           `json:"if_exists,omitempty"`
}

DropNamedCollectionQuery represents a DROP NAMED COLLECTION statement.

func (*DropNamedCollectionQuery) End

func (*DropNamedCollectionQuery) Pos

type DropQuery

type DropQuery struct {
	Position        token.Position     `json:"-"`
	IfExists        bool               `json:"if_exists,omitempty"`
	Database        string             `json:"database,omitempty"`
	Table           string             `json:"table,omitempty"`
	Tables          []*TableIdentifier `json:"tables,omitempty"` // For DROP TABLE t1, t2, t3
	View            string             `json:"view,omitempty"`
	User            string             `json:"user,omitempty"`
	Function        string             `json:"function,omitempty"`         // For DROP FUNCTION
	Dictionary      string             `json:"-"`                          // For DROP DICTIONARY (format only, not in AST JSON)
	Role            string             `json:"role,omitempty"`             // For DROP ROLE
	Quota           string             `json:"quota,omitempty"`            // For DROP QUOTA
	Policy          string             `json:"policy,omitempty"`           // For DROP POLICY
	RowPolicy       string             `json:"row_policy,omitempty"`       // For DROP ROW POLICY
	SettingsProfile string             `json:"settings_profile,omitempty"` // For DROP SETTINGS PROFILE
	Index           string             `json:"index,omitempty"`            // For DROP INDEX
	Temporary       bool               `json:"temporary,omitempty"`
	OnCluster       string             `json:"on_cluster,omitempty"`
	DropDatabase    bool               `json:"drop_database,omitempty"`
	Sync            bool               `json:"sync,omitempty"`
	Format          string             `json:"format,omitempty"`   // For FORMAT clause
	Settings        []*SettingExpr     `json:"settings,omitempty"` // For SETTINGS clause
}

DropQuery represents a DROP statement.

func (*DropQuery) End

func (d *DropQuery) End() token.Position

func (*DropQuery) Pos

func (d *DropQuery) Pos() token.Position

type DropResourceQuery

type DropResourceQuery struct {
	Position token.Position `json:"-"`
}

DropResourceQuery represents a DROP RESOURCE statement.

func (*DropResourceQuery) End

func (d *DropResourceQuery) End() token.Position

func (*DropResourceQuery) Pos

func (d *DropResourceQuery) Pos() token.Position

type DropRoleQuery

type DropRoleQuery struct {
	Position token.Position `json:"-"`
	IfExists bool           `json:"if_exists,omitempty"`
}

DropRoleQuery represents a DROP ROLE statement.

func (*DropRoleQuery) End

func (d *DropRoleQuery) End() token.Position

func (*DropRoleQuery) Pos

func (d *DropRoleQuery) Pos() token.Position

type DropRowPolicyQuery

type DropRowPolicyQuery struct {
	Position token.Position `json:"-"`
	IfExists bool           `json:"if_exists,omitempty"`
}

DropRowPolicyQuery represents a DROP ROW POLICY statement.

func (*DropRowPolicyQuery) End

func (*DropRowPolicyQuery) Pos

type DropSettingsProfileQuery

type DropSettingsProfileQuery struct {
	Position token.Position `json:"-"`
	Names    []string       `json:"names,omitempty"`
	IfExists bool           `json:"if_exists,omitempty"`
}

DropSettingsProfileQuery represents a DROP SETTINGS PROFILE statement.

func (*DropSettingsProfileQuery) End

func (*DropSettingsProfileQuery) Pos

type DropWorkloadQuery

type DropWorkloadQuery struct {
	Position token.Position `json:"-"`
}

DropWorkloadQuery represents a DROP WORKLOAD statement.

func (*DropWorkloadQuery) End

func (d *DropWorkloadQuery) End() token.Position

func (*DropWorkloadQuery) Pos

func (d *DropWorkloadQuery) Pos() token.Position

type EngineClause

type EngineClause struct {
	Position       token.Position `json:"-"`
	Name           string         `json:"name"`
	Parameters     []Expression   `json:"parameters,omitempty"`
	HasParentheses bool           `json:"has_parentheses,omitempty"` // true if called with ()
}

EngineClause represents an ENGINE clause.

func (*EngineClause) End

func (e *EngineClause) End() token.Position

func (*EngineClause) Pos

func (e *EngineClause) Pos() token.Position

type ExchangeQuery

type ExchangeQuery struct {
	Position  token.Position `json:"-"`
	Database1 string         `json:"database1,omitempty"`
	Table1    string         `json:"table1"`
	Database2 string         `json:"database2,omitempty"`
	Table2    string         `json:"table2"`
	OnCluster string         `json:"on_cluster,omitempty"`
}

ExchangeQuery represents an EXCHANGE TABLES statement.

func (*ExchangeQuery) End

func (e *ExchangeQuery) End() token.Position

func (*ExchangeQuery) Pos

func (e *ExchangeQuery) Pos() token.Position

type ExistsExpr

type ExistsExpr struct {
	Position token.Position `json:"-"`
	Query    Statement      `json:"query"`
}

ExistsExpr represents an EXISTS expression.

func (*ExistsExpr) End

func (e *ExistsExpr) End() token.Position

func (*ExistsExpr) Pos

func (e *ExistsExpr) Pos() token.Position

type ExistsQuery

type ExistsQuery struct {
	Position   token.Position `json:"-"`
	ExistsType ExistsType     `json:"exists_type,omitempty"`
	Temporary  bool           `json:"temporary,omitempty"`
	Database   string         `json:"database,omitempty"`
	Table      string         `json:"table"`
	Settings   []*SettingExpr `json:"settings,omitempty"`
}

ExistsQuery represents an EXISTS table_name statement (check if table exists).

func (*ExistsQuery) End

func (e *ExistsQuery) End() token.Position

func (*ExistsQuery) Pos

func (e *ExistsQuery) Pos() token.Position

type ExistsType

type ExistsType string

ExistsType represents the type of EXISTS query.

const (
	ExistsTable      ExistsType = "TABLE"
	ExistsDictionary ExistsType = "DICTIONARY"
	ExistsDatabase   ExistsType = "DATABASE"
	ExistsView       ExistsType = "VIEW"
)

type ExplainQuery

type ExplainQuery struct {
	Position      token.Position `json:"-"`
	ExplainType   ExplainType    `json:"explain_type"`
	Statement     Statement      `json:"statement"`
	HasSettings   bool           `json:"has_settings,omitempty"`
	ExplicitType  bool           `json:"explicit_type,omitempty"`  // true if type was explicitly specified
	OptionsString string         `json:"options_string,omitempty"` // Formatted options like "actions = 1"
}

ExplainQuery represents an EXPLAIN statement.

func (*ExplainQuery) End

func (e *ExplainQuery) End() token.Position

func (*ExplainQuery) Pos

func (e *ExplainQuery) Pos() token.Position

type ExplainType

type ExplainType string

ExplainType represents the type of EXPLAIN.

const (
	ExplainAST                ExplainType = "AST"
	ExplainSyntax             ExplainType = "SYNTAX"
	ExplainPlan               ExplainType = "PLAN"
	ExplainPipeline           ExplainType = "PIPELINE"
	ExplainEstimate           ExplainType = "ESTIMATE"
	ExplainQueryTree          ExplainType = "QUERY TREE"
	ExplainCurrentTransaction ExplainType = "CURRENT TRANSACTION"
)

type Expression

type Expression interface {
	Node
	// contains filtered or unexported methods
}

Expression is the interface implemented by all expression nodes.

type ExtractExpr

type ExtractExpr struct {
	Position token.Position `json:"-"`
	Field    string         `json:"field"` // YEAR, MONTH, DAY, etc.
	From     Expression     `json:"from"`
	Alias    string         `json:"alias,omitempty"`
}

ExtractExpr represents an EXTRACT expression.

func (*ExtractExpr) End

func (e *ExtractExpr) End() token.Position

func (*ExtractExpr) Pos

func (e *ExtractExpr) Pos() token.Position

type FrameBound

type FrameBound struct {
	Position token.Position `json:"-"`
	Type     FrameBoundType `json:"type"`
	Offset   Expression     `json:"offset,omitempty"`
}

FrameBound represents a window frame bound.

func (*FrameBound) End

func (f *FrameBound) End() token.Position

func (*FrameBound) Pos

func (f *FrameBound) Pos() token.Position

type FrameBoundType

type FrameBoundType string

FrameBoundType represents the type of frame bound.

const (
	BoundCurrentRow   FrameBoundType = "CURRENT_ROW"
	BoundUnboundedPre FrameBoundType = "UNBOUNDED_PRECEDING"
	BoundUnboundedFol FrameBoundType = "UNBOUNDED_FOLLOWING"
	BoundPreceding    FrameBoundType = "PRECEDING"
	BoundFollowing    FrameBoundType = "FOLLOWING"
)

type FunctionCall

type FunctionCall struct {
	Position    token.Position `json:"-"`
	Name        string         `json:"name"`
	Parameters  []Expression   `json:"parameters,omitempty"` // For parametric functions like quantile(0.9)(x)
	Arguments   []Expression   `json:"arguments,omitempty"`
	Settings    []*SettingExpr `json:"settings,omitempty"` // For table functions with SETTINGS
	Distinct    bool           `json:"distinct,omitempty"`
	Filter      Expression     `json:"filter,omitempty"` // FILTER(WHERE condition) clause
	Over        *WindowSpec    `json:"over,omitempty"`
	Alias       string         `json:"alias,omitempty"`
	SQLStandard bool           `json:"sql_standard,omitempty"` // True for SQL standard syntax like TRIM(... FROM ...)
}

FunctionCall represents a function call.

func (*FunctionCall) End

func (f *FunctionCall) End() token.Position

func (*FunctionCall) Pos

func (f *FunctionCall) Pos() token.Position

type GrantQuery

type GrantQuery struct {
	Position token.Position `json:"-"`
	IsRevoke bool           `json:"is_revoke,omitempty"`
}

GrantQuery represents a GRANT or REVOKE statement.

func (*GrantQuery) End

func (g *GrantQuery) End() token.Position

func (*GrantQuery) Pos

func (g *GrantQuery) Pos() token.Position

type Identifier

type Identifier struct {
	Position      token.Position `json:"-"`
	Parts         []string       `json:"parts"` // e.g., ["db", "table", "column"] for db.table.column
	Alias         string         `json:"alias,omitempty"`
	Parenthesized bool           `json:"-"` // true if wrapped in parentheses, affects dot access parsing
}

Identifier represents an identifier.

func (*Identifier) End

func (i *Identifier) End() token.Position

func (*Identifier) Name

func (i *Identifier) Name() string

Name returns the full identifier name.

func (*Identifier) Pos

func (i *Identifier) Pos() token.Position

type InExpr

type InExpr struct {
	Position      token.Position `json:"-"`
	Expr          Expression     `json:"expr"`
	Not           bool           `json:"not,omitempty"`
	Global        bool           `json:"global,omitempty"`
	List          []Expression   `json:"list,omitempty"`
	Query         Statement      `json:"query,omitempty"`
	TrailingComma bool           `json:"trailing_comma,omitempty"` // true if list had trailing comma like (2,)
}

InExpr represents an IN expression.

func (*InExpr) End

func (i *InExpr) End() token.Position

func (*InExpr) Pos

func (i *InExpr) Pos() token.Position

type IndexDefinition

type IndexDefinition struct {
	Position    token.Position `json:"-"`
	Name        string         `json:"name"`
	Expression  Expression     `json:"expression"`
	Type        *FunctionCall  `json:"type"`
	Granularity Expression     `json:"granularity,omitempty"`
}

IndexDefinition represents an INDEX definition in CREATE TABLE.

func (*IndexDefinition) End

func (i *IndexDefinition) End() token.Position

func (*IndexDefinition) Pos

func (i *IndexDefinition) Pos() token.Position

type InsertQuery

type InsertQuery struct {
	Position          token.Position `json:"-"`
	Database          string         `json:"database,omitempty"`
	Table             string         `json:"table,omitempty"`
	Function          *FunctionCall  `json:"function,omitempty"` // For INSERT INTO FUNCTION syntax
	Columns           []*Identifier  `json:"columns,omitempty"`
	ColumnExpressions []Expression   `json:"column_expressions,omitempty"` // For asterisk/COLUMNS expressions with transformers
	AllColumns        bool           `json:"all_columns,omitempty"`        // For (*) syntax meaning all columns
	PartitionBy       Expression     `json:"partition_by,omitempty"`       // For PARTITION BY clause
	Infile            string         `json:"infile,omitempty"`             // For FROM INFILE clause
	Compression       string         `json:"compression,omitempty"`        // For COMPRESSION clause
	Values            [][]Expression `json:"-"`                            // For VALUES clause (format only, not in AST JSON)
	Select            Statement      `json:"select,omitempty"`
	With              []Expression   `json:"with,omitempty"` // For WITH ... INSERT ... SELECT syntax
	Format            *Identifier    `json:"format,omitempty"`
	HasSettings       bool           `json:"has_settings,omitempty"` // For SETTINGS clause
	Settings          []*SettingExpr `json:"settings,omitempty"`     // For SETTINGS clause in INSERT
}

InsertQuery represents an INSERT statement.

func (*InsertQuery) End

func (i *InsertQuery) End() token.Position

func (*InsertQuery) Pos

func (i *InsertQuery) Pos() token.Position

type InterpolateElement

type InterpolateElement struct {
	Position token.Position `json:"-"`
	Column   string         `json:"column"`
	Value    Expression     `json:"value,omitempty"` // nil if just column name
}

InterpolateElement represents a single column interpolation in INTERPOLATE clause. Example: INTERPOLATE (value AS value + 1)

func (*InterpolateElement) End

func (*InterpolateElement) Pos

type IntervalExpr

type IntervalExpr struct {
	Position token.Position `json:"-"`
	Value    Expression     `json:"value"`
	Unit     string         `json:"unit"` // YEAR, MONTH, DAY, HOUR, MINUTE, SECOND, etc.
}

IntervalExpr represents an INTERVAL expression.

func (*IntervalExpr) End

func (i *IntervalExpr) End() token.Position

func (*IntervalExpr) Pos

func (i *IntervalExpr) Pos() token.Position

type IntoOutfileClause

type IntoOutfileClause struct {
	Position token.Position `json:"-"`
	Filename string         `json:"filename"`
	Truncate bool           `json:"truncate,omitempty"`
}

IntoOutfileClause represents INTO OUTFILE clause.

func (*IntoOutfileClause) End

func (i *IntoOutfileClause) End() token.Position

func (*IntoOutfileClause) Pos

func (i *IntoOutfileClause) Pos() token.Position

type IsNullExpr

type IsNullExpr struct {
	Position token.Position `json:"-"`
	Expr     Expression     `json:"expr"`
	Not      bool           `json:"not,omitempty"`
}

IsNullExpr represents an IS NULL or IS NOT NULL expression.

func (*IsNullExpr) End

func (i *IsNullExpr) End() token.Position

func (*IsNullExpr) Pos

func (i *IsNullExpr) Pos() token.Position

type JoinStrictness

type JoinStrictness string

JoinStrictness represents the join strictness.

const (
	JoinStrictAny  JoinStrictness = "ANY"
	JoinStrictAll  JoinStrictness = "ALL"
	JoinStrictAsof JoinStrictness = "ASOF"
	JoinStrictSemi JoinStrictness = "SEMI"
	JoinStrictAnti JoinStrictness = "ANTI"
)

type JoinType

type JoinType string

JoinType represents the type of join.

const (
	JoinInner JoinType = "INNER"
	JoinLeft  JoinType = "LEFT"
	JoinRight JoinType = "RIGHT"
	JoinFull  JoinType = "FULL"
	JoinCross JoinType = "CROSS"
	JoinPaste JoinType = "PASTE"
)

type KeyValuePair

type KeyValuePair struct {
	Position token.Position `json:"-"`
	Key      string         `json:"key"`
	Value    Expression     `json:"value"`
}

KeyValuePair represents a key-value pair in dictionary source or other contexts.

func (*KeyValuePair) End

func (k *KeyValuePair) End() token.Position

func (*KeyValuePair) Pos

func (k *KeyValuePair) Pos() token.Position

type KillQuery

type KillQuery struct {
	Position token.Position `json:"-"`
	Type     string         `json:"type"`             // "QUERY" or "MUTATION"
	Where    Expression     `json:"where,omitempty"`  // WHERE condition
	Sync     bool           `json:"sync,omitempty"`   // SYNC mode (default false = ASYNC)
	Test     bool           `json:"test,omitempty"`   // TEST mode
	Format   string         `json:"format,omitempty"` // FORMAT clause
	Settings []*SettingExpr `json:"settings,omitempty"`
}

KillQuery represents a KILL QUERY/MUTATION statement.

func (*KillQuery) End

func (k *KillQuery) End() token.Position

func (*KillQuery) Pos

func (k *KillQuery) Pos() token.Position

type Lambda

type Lambda struct {
	Position      token.Position `json:"-"`
	Parameters    []string       `json:"parameters"`
	Body          Expression     `json:"body"`
	Parenthesized bool           `json:"-"` // True if wrapped in explicit parentheses
}

Lambda represents a lambda expression.

func (*Lambda) End

func (l *Lambda) End() token.Position

func (*Lambda) Pos

func (l *Lambda) Pos() token.Position

type LikeExpr

type LikeExpr struct {
	Position        token.Position `json:"-"`
	Expr            Expression     `json:"expr"`
	Not             bool           `json:"not,omitempty"`
	CaseInsensitive bool           `json:"case_insensitive,omitempty"` // true for ILIKE
	Pattern         Expression     `json:"pattern"`
	Alias           string         `json:"alias,omitempty"`
}

LikeExpr represents a LIKE or ILIKE expression.

func (*LikeExpr) End

func (l *LikeExpr) End() token.Position

func (*LikeExpr) Pos

func (l *LikeExpr) Pos() token.Position

type Literal

type Literal struct {
	Position       token.Position `json:"-"`
	Type           LiteralType    `json:"type"`
	Value          interface{}    `json:"value"`
	Source         string         `json:"source,omitempty"`          // Original source text (for preserving 0.0 vs 0)
	Negative       bool           `json:"negative,omitempty"`        // True if literal was explicitly negative (for -0)
	Parenthesized  bool           `json:"parenthesized,omitempty"`   // True if wrapped in explicit parentheses
	SpacedCommas   bool           `json:"spaced_commas,omitempty"`   // True if array/tuple had spaces after commas
	SpacedBrackets bool           `json:"spaced_brackets,omitempty"` // True if array had whitespace after [ and before ]
	IsBigInt       bool           `json:"is_big_int,omitempty"`      // True if this is a large integer stored as string
}

Literal represents a literal value.

func (*Literal) End

func (l *Literal) End() token.Position

func (*Literal) MarshalJSON

func (l *Literal) MarshalJSON() ([]byte, error)

MarshalJSON handles special float values (NaN, +Inf, -Inf) that JSON doesn't support.

func (*Literal) Pos

func (l *Literal) Pos() token.Position

type LiteralType

type LiteralType string

LiteralType represents the type of a literal.

const (
	LiteralString  LiteralType = "String"
	LiteralInteger LiteralType = "Integer"
	LiteralFloat   LiteralType = "Float"
	LiteralBoolean LiteralType = "Boolean"
	LiteralNull    LiteralType = "Null"
	LiteralArray   LiteralType = "Array"
	LiteralTuple   LiteralType = "Tuple"
)

type NameTypePair

type NameTypePair struct {
	Position token.Position `json:"-"`
	Name     string         `json:"name"`
	Type     *DataType      `json:"type"`
}

NameTypePair represents a named type pair, used in Nested types.

func (*NameTypePair) End

func (n *NameTypePair) End() token.Position

func (*NameTypePair) Pos

func (n *NameTypePair) Pos() token.Position

type Node

type Node interface {
	Pos() token.Position
	End() token.Position
}

Node is the interface implemented by all AST nodes.

type ObjectTypeArgument

type ObjectTypeArgument struct {
	Position token.Position `json:"-"`
	Expr     Expression     `json:"expr"`
}

ObjectTypeArgument wraps an expression that is an argument to JSON/OBJECT types. This matches ClickHouse's ASTObjectTypeArgument node structure.

func (*ObjectTypeArgument) End

func (*ObjectTypeArgument) Pos

type OptimizeQuery

type OptimizeQuery struct {
	Position      token.Position `json:"-"`
	Database      string         `json:"database,omitempty"`
	Table         string         `json:"table"`
	Partition     Expression     `json:"partition,omitempty"`
	PartitionByID bool           `json:"partition_by_id,omitempty"` // PARTITION ID vs PARTITION expr
	Final         bool           `json:"final,omitempty"`
	Cleanup       bool           `json:"cleanup,omitempty"`
	Dedupe        bool           `json:"dedupe,omitempty"`
	OnCluster     string         `json:"on_cluster,omitempty"`
	Settings      []*SettingExpr `json:"settings,omitempty"`
}

OptimizeQuery represents an OPTIMIZE statement.

func (*OptimizeQuery) End

func (o *OptimizeQuery) End() token.Position

func (*OptimizeQuery) Pos

func (o *OptimizeQuery) Pos() token.Position

type OrderByElement

type OrderByElement struct {
	Position      token.Position `json:"-"`
	Expression    Expression     `json:"expression"`
	Descending    bool           `json:"descending,omitempty"`
	NullsFirst    *bool          `json:"nulls_first,omitempty"`
	Collate       string         `json:"collate,omitempty"`
	WithFill      bool           `json:"with_fill,omitempty"`
	FillFrom      Expression     `json:"fill_from,omitempty"`
	FillTo        Expression     `json:"fill_to,omitempty"`
	FillStep      Expression     `json:"fill_step,omitempty"`
	FillStaleness Expression     `json:"fill_staleness,omitempty"`
}

OrderByElement represents an ORDER BY element.

func (*OrderByElement) End

func (o *OrderByElement) End() token.Position

func (*OrderByElement) Pos

func (o *OrderByElement) Pos() token.Position

type ParallelWithQuery

type ParallelWithQuery struct {
	Position   token.Position `json:"-"`
	Statements []Statement    `json:"statements"`
}

ParallelWithQuery represents multiple statements executed in parallel with PARALLEL WITH.

func (*ParallelWithQuery) End

func (p *ParallelWithQuery) End() token.Position

func (*ParallelWithQuery) Pos

func (p *ParallelWithQuery) Pos() token.Position

type Parameter

type Parameter struct {
	Position token.Position `json:"-"`
	Name     string         `json:"name,omitempty"`
	Type     *DataType      `json:"type,omitempty"`
}

Parameter represents a parameter placeholder.

func (*Parameter) End

func (p *Parameter) End() token.Position

func (*Parameter) Pos

func (p *Parameter) Pos() token.Position

type Projection

type Projection struct {
	Position token.Position         `json:"-"`
	Name     string                 `json:"name"`
	Select   *ProjectionSelectQuery `json:"select"`
}

Projection represents a projection definition.

func (*Projection) End

func (p *Projection) End() token.Position

func (*Projection) Pos

func (p *Projection) Pos() token.Position

type ProjectionSelectQuery

type ProjectionSelectQuery struct {
	Position token.Position `json:"-"`
	With     []Expression   `json:"with,omitempty"` // WITH clause expressions
	Columns  []Expression   `json:"columns"`
	GroupBy  []Expression   `json:"group_by,omitempty"`
	OrderBy  []Expression   `json:"order_by,omitempty"` // ORDER BY columns
}

ProjectionSelectQuery represents the SELECT part of a projection.

type RenamePair

type RenamePair struct {
	FromDatabase string `json:"from_database,omitempty"`
	FromTable    string `json:"from_table"`
	ToDatabase   string `json:"to_database,omitempty"`
	ToTable      string `json:"to_table"`
}

RenamePair represents a single rename pair in RENAME TABLE.

type RenameQuery

type RenameQuery struct {
	Position       token.Position `json:"-"`
	Pairs          []*RenamePair  `json:"pairs"`          // Multiple rename pairs
	From           string         `json:"from,omitempty"` // Deprecated: for backward compat
	To             string         `json:"to,omitempty"`   // Deprecated: for backward compat
	OnCluster      string         `json:"on_cluster,omitempty"`
	Settings       []*SettingExpr `json:"settings,omitempty"`
	IfExists       bool           `json:"if_exists,omitempty"`       // IF EXISTS modifier
	RenameDatabase bool           `json:"rename_database,omitempty"` // True for RENAME DATABASE
}

RenameQuery represents a RENAME TABLE statement.

func (*RenameQuery) End

func (r *RenameQuery) End() token.Position

func (*RenameQuery) Pos

func (r *RenameQuery) Pos() token.Position

type ReplaceExpr

type ReplaceExpr struct {
	Position token.Position `json:"-"`
	Expr     Expression     `json:"expr"`
	Name     string         `json:"name"`
}

ReplaceExpr represents an expression in REPLACE clause.

func (*ReplaceExpr) End

func (r *ReplaceExpr) End() token.Position

func (*ReplaceExpr) Pos

func (r *ReplaceExpr) Pos() token.Position

type RestoreQuery

type RestoreQuery struct {
	Position   token.Position `json:"-"`
	Database   string         `json:"database,omitempty"`
	Table      string         `json:"table,omitempty"`
	Dictionary string         `json:"dictionary,omitempty"`
	All        bool           `json:"all,omitempty"` // RESTORE ALL
	Temporary  bool           `json:"temporary,omitempty"`
	Source     *FunctionCall  `json:"source,omitempty"` // Disk('path') or Null
	Settings   []*SettingExpr `json:"settings,omitempty"`
	Format     string         `json:"format,omitempty"`
}

RestoreQuery represents a RESTORE statement.

func (*RestoreQuery) End

func (r *RestoreQuery) End() token.Position

func (*RestoreQuery) Pos

func (r *RestoreQuery) Pos() token.Position

type SampleClause

type SampleClause struct {
	Position token.Position `json:"-"`
	Ratio    Expression     `json:"ratio"`
	Offset   Expression     `json:"offset,omitempty"`
}

SampleClause represents a SAMPLE clause.

func (*SampleClause) End

func (s *SampleClause) End() token.Position

func (*SampleClause) Pos

func (s *SampleClause) Pos() token.Position

type SelectIntersectExceptQuery

type SelectIntersectExceptQuery struct {
	Position  token.Position `json:"-"`
	Selects   []Statement    `json:"selects"`
	Operators []string       `json:"operators,omitempty"` // "INTERSECT", "EXCEPT", etc. for each operator between selects
}

SelectIntersectExceptQuery represents SELECT ... INTERSECT/EXCEPT ... queries.

func (*SelectIntersectExceptQuery) End

func (*SelectIntersectExceptQuery) Pos

type SelectQuery

type SelectQuery struct {
	Position             token.Position        `json:"-"`
	With                 []Expression          `json:"with,omitempty"`
	Distinct             bool                  `json:"distinct,omitempty"`
	DistinctOn           []Expression          `json:"distinct_on,omitempty"` // DISTINCT ON (col1, col2, ...) syntax
	Top                  Expression            `json:"top,omitempty"`
	Columns              []Expression          `json:"columns"`
	From                 *TablesInSelectQuery  `json:"from,omitempty"`
	ArrayJoin            *ArrayJoinClause      `json:"array_join,omitempty"`
	PreWhere             Expression            `json:"prewhere,omitempty"`
	Where                Expression            `json:"where,omitempty"`
	GroupBy              []Expression          `json:"group_by,omitempty"`
	GroupByAll           bool                  `json:"group_by_all,omitempty"`  // true if GROUP BY ALL was used
	GroupingSets         bool                  `json:"grouping_sets,omitempty"` // true if GROUP BY uses GROUPING SETS
	WithRollup           bool                  `json:"with_rollup,omitempty"`
	WithCube             bool                  `json:"with_cube,omitempty"`
	WithTotals           bool                  `json:"with_totals,omitempty"`
	Having               Expression            `json:"having,omitempty"`
	Qualify              Expression            `json:"qualify,omitempty"`
	Window               []*WindowDefinition   `json:"window,omitempty"`
	OrderBy              []*OrderByElement     `json:"order_by,omitempty"`
	Interpolate          []*InterpolateElement `json:"interpolate,omitempty"`
	Limit                Expression            `json:"limit,omitempty"`
	LimitBy              []Expression          `json:"limit_by,omitempty"`
	LimitByLimit         Expression            `json:"limit_by_limit,omitempty"`     // LIMIT value before BY (e.g., LIMIT 1 BY x LIMIT 3)
	LimitByOffset        Expression            `json:"limit_by_offset,omitempty"`    // Offset for LIMIT BY (e.g., LIMIT 2, 3 BY x -> offset=2)
	LimitByHasLimit      bool                  `json:"limit_by_has_limit,omitempty"` // true if LIMIT BY was followed by another LIMIT
	Offset               Expression            `json:"offset,omitempty"`
	Settings             []*SettingExpr        `json:"settings,omitempty"`
	SettingsAfterFormat  bool                  `json:"settings_after_format,omitempty"`  // true if SETTINGS came after FORMAT (at union level)
	SettingsBeforeFormat bool                  `json:"settings_before_format,omitempty"` // true if SETTINGS came before FORMAT (at union level)
	IntoOutfile          *IntoOutfileClause    `json:"into_outfile,omitempty"`
	Format               *Identifier           `json:"format,omitempty"`
}

SelectQuery represents a SELECT statement.

func (*SelectQuery) End

func (s *SelectQuery) End() token.Position

func (*SelectQuery) Pos

func (s *SelectQuery) Pos() token.Position

type SelectWithUnionQuery

type SelectWithUnionQuery struct {
	Position             token.Position `json:"-"`
	Selects              []Statement    `json:"selects"`
	UnionAll             bool           `json:"union_all,omitempty"`
	UnionModes           []string       `json:"union_modes,omitempty"` // "ALL", "DISTINCT", or "" for each union
	Settings             []*SettingExpr `json:"settings,omitempty"`    // Union-level SETTINGS
	SettingsAfterFormat  bool           `json:"settings_after_format,omitempty"`
	SettingsBeforeFormat bool           `json:"settings_before_format,omitempty"`
}

SelectWithUnionQuery represents a SELECT query possibly with UNION.

func (*SelectWithUnionQuery) End

func (*SelectWithUnionQuery) Pos

type SetQuery

type SetQuery struct {
	Position token.Position `json:"-"`
	Settings []*SettingExpr `json:"settings"`
}

SetQuery represents a SET statement.

func (*SetQuery) End

func (s *SetQuery) End() token.Position

func (*SetQuery) Pos

func (s *SetQuery) Pos() token.Position

type SetRoleQuery

type SetRoleQuery struct {
	Position token.Position `json:"-"`
}

SetRoleQuery represents a SET DEFAULT ROLE statement.

func (*SetRoleQuery) End

func (s *SetRoleQuery) End() token.Position

func (*SetRoleQuery) Pos

func (s *SetRoleQuery) Pos() token.Position

type SettingExpr

type SettingExpr struct {
	Position token.Position `json:"-"`
	Name     string         `json:"name"`
	Value    Expression     `json:"value"`
}

SettingExpr represents a setting expression.

func (*SettingExpr) End

func (s *SettingExpr) End() token.Position

func (*SettingExpr) Pos

func (s *SettingExpr) Pos() token.Position

type ShowCreateQuotaQuery

type ShowCreateQuotaQuery struct {
	Position token.Position `json:"-"`
	Name     string         `json:"name,omitempty"`
	Format   string         `json:"format,omitempty"`
}

ShowCreateQuotaQuery represents a SHOW CREATE QUOTA statement.

func (*ShowCreateQuotaQuery) End

func (*ShowCreateQuotaQuery) Pos

type ShowCreateRoleQuery

type ShowCreateRoleQuery struct {
	Position  token.Position `json:"-"`
	RoleCount int            `json:"role_count,omitempty"` // Number of roles specified
	Format    string         `json:"format,omitempty"`
}

ShowCreateRoleQuery represents a SHOW CREATE ROLE statement.

func (*ShowCreateRoleQuery) End

func (*ShowCreateRoleQuery) Pos

type ShowCreateRowPolicyQuery

type ShowCreateRowPolicyQuery struct {
	Position token.Position `json:"-"`
	Format   string         `json:"format,omitempty"`
}

ShowCreateRowPolicyQuery represents a SHOW CREATE ROW POLICY statement.

func (*ShowCreateRowPolicyQuery) End

func (*ShowCreateRowPolicyQuery) Pos

type ShowCreateSettingsProfileQuery

type ShowCreateSettingsProfileQuery struct {
	Position token.Position `json:"-"`
	Names    []string       `json:"names,omitempty"`
	Format   string         `json:"format,omitempty"`
}

ShowCreateSettingsProfileQuery represents a SHOW CREATE SETTINGS PROFILE statement.

func (*ShowCreateSettingsProfileQuery) End

func (*ShowCreateSettingsProfileQuery) Pos

type ShowGrantsQuery

type ShowGrantsQuery struct {
	Position token.Position `json:"-"`
	Format   string         `json:"format,omitempty"`
}

ShowGrantsQuery represents a SHOW GRANTS statement.

func (*ShowGrantsQuery) End

func (s *ShowGrantsQuery) End() token.Position

func (*ShowGrantsQuery) Pos

func (s *ShowGrantsQuery) Pos() token.Position

type ShowPrivilegesQuery

type ShowPrivilegesQuery struct {
	Position token.Position `json:"-"`
}

ShowPrivilegesQuery represents a SHOW PRIVILEGES statement.

func (*ShowPrivilegesQuery) End

func (*ShowPrivilegesQuery) Pos

type ShowQuery

type ShowQuery struct {
	Position      token.Position `json:"-"`
	ShowType      ShowType       `json:"show_type"`
	Temporary     bool           `json:"temporary,omitempty"`
	Database      string         `json:"database,omitempty"`
	From          string         `json:"from,omitempty"`
	Like          string         `json:"like,omitempty"`
	Where         Expression     `json:"where,omitempty"`
	Limit         Expression     `json:"limit,omitempty"`
	Format        string         `json:"format,omitempty"`
	HasSettings   bool           `json:"has_settings,omitempty"`   // Whether SETTINGS clause was specified
	MultipleUsers bool           `json:"multiple_users,omitempty"` // True when SHOW CREATE USER has multiple users
}

ShowQuery represents a SHOW statement.

func (*ShowQuery) End

func (s *ShowQuery) End() token.Position

func (*ShowQuery) Pos

func (s *ShowQuery) Pos() token.Position

type ShowType

type ShowType string

ShowType represents the type of SHOW statement.

const (
	ShowTables                ShowType = "TABLES"
	ShowDatabases             ShowType = "DATABASES"
	ShowProcesses             ShowType = "PROCESSLIST"
	ShowCreate                ShowType = "CREATE"
	ShowCreateDB              ShowType = "CREATE_DATABASE"
	ShowCreateDictionary      ShowType = "CREATE_DICTIONARY"
	ShowCreateView            ShowType = "CREATE_VIEW"
	ShowCreateUser            ShowType = "CREATE_USER"
	ShowCreateRole            ShowType = "CREATE_ROLE"
	ShowCreatePolicy          ShowType = "CREATE_POLICY"
	ShowCreateRowPolicy       ShowType = "CREATE_ROW_POLICY"
	ShowCreateQuota           ShowType = "CREATE_QUOTA"
	ShowCreateSettingsProfile ShowType = "CREATE_SETTINGS_PROFILE"
	ShowColumns               ShowType = "COLUMNS"
	ShowDictionaries          ShowType = "DICTIONARIES"
	ShowFunctions             ShowType = "FUNCTIONS"
	ShowSettings              ShowType = "SETTINGS"
	ShowSetting               ShowType = "SETTING"
	ShowGrants                ShowType = "GRANTS"
)

type Statement

type Statement interface {
	Node
	// contains filtered or unexported methods
}

Statement is the interface implemented by all statement nodes.

type Subquery

type Subquery struct {
	Position token.Position `json:"-"`
	Query    Statement      `json:"query"`
	Alias    string         `json:"alias,omitempty"`
}

Subquery represents a subquery.

func (*Subquery) End

func (s *Subquery) End() token.Position

func (*Subquery) Pos

func (s *Subquery) Pos() token.Position

type SystemQuery

type SystemQuery struct {
	Position             token.Position `json:"-"`
	Command              string         `json:"command"`
	Database             string         `json:"database,omitempty"`
	Table                string         `json:"table,omitempty"`
	OnCluster            string         `json:"on_cluster,omitempty"`
	DuplicateTableOutput bool           `json:"duplicate_table_output,omitempty"` // True for commands that need database/table output twice
	Settings             []*SettingExpr `json:"settings,omitempty"`
}

SystemQuery represents a SYSTEM statement.

func (*SystemQuery) End

func (s *SystemQuery) End() token.Position

func (*SystemQuery) Pos

func (s *SystemQuery) Pos() token.Position

type TTLClause

type TTLClause struct {
	Position    token.Position `json:"-"`
	Expression  Expression     `json:"expression"`
	Expressions []Expression   `json:"expressions,omitempty"` // Additional TTL expressions (for multiple TTL elements)
	Elements    []*TTLElement  `json:"elements,omitempty"`    // TTL elements with WHERE conditions
}

TTLClause represents a TTL clause.

func (*TTLClause) End

func (t *TTLClause) End() token.Position

func (*TTLClause) Pos

func (t *TTLClause) Pos() token.Position

type TTLElement

type TTLElement struct {
	Position token.Position `json:"-"`
	Expr     Expression     `json:"expr"`
	Where    Expression     `json:"where,omitempty"` // WHERE condition for DELETE
}

TTLElement represents a single TTL element with optional WHERE condition.

func (*TTLElement) End

func (t *TTLElement) End() token.Position

func (*TTLElement) Pos

func (t *TTLElement) Pos() token.Position

type TableExpression

type TableExpression struct {
	Position token.Position `json:"-"`
	Table    Expression     `json:"table"` // TableIdentifier, Subquery, or Function
	Alias    string         `json:"alias,omitempty"`
	Final    bool           `json:"final,omitempty"`
	Sample   *SampleClause  `json:"sample,omitempty"`
}

TableExpression represents a table reference.

func (*TableExpression) End

func (t *TableExpression) End() token.Position

func (*TableExpression) Pos

func (t *TableExpression) Pos() token.Position

type TableIdentifier

type TableIdentifier struct {
	Position token.Position `json:"-"`
	Database string         `json:"database,omitempty"`
	Table    string         `json:"table"`
	Alias    string         `json:"alias,omitempty"`
}

TableIdentifier represents a table identifier.

func (*TableIdentifier) End

func (t *TableIdentifier) End() token.Position

func (*TableIdentifier) Pos

func (t *TableIdentifier) Pos() token.Position

type TableJoin

type TableJoin struct {
	Position   token.Position `json:"-"`
	Type       JoinType       `json:"type"`
	Strictness JoinStrictness `json:"strictness,omitempty"`
	Global     bool           `json:"global,omitempty"`
	On         Expression     `json:"on,omitempty"`
	Using      []Expression   `json:"using,omitempty"`
}

TableJoin represents a JOIN clause.

func (*TableJoin) End

func (t *TableJoin) End() token.Position

func (*TableJoin) Pos

func (t *TableJoin) Pos() token.Position

type TablesInSelectQuery

type TablesInSelectQuery struct {
	Position token.Position                `json:"-"`
	Tables   []*TablesInSelectQueryElement `json:"tables"`
}

TablesInSelectQuery represents the tables in a SELECT query.

func (*TablesInSelectQuery) End

func (*TablesInSelectQuery) Pos

type TablesInSelectQueryElement

type TablesInSelectQueryElement struct {
	Position  token.Position   `json:"-"`
	Table     *TableExpression `json:"table,omitempty"`
	Join      *TableJoin       `json:"join,omitempty"`
	ArrayJoin *ArrayJoinClause `json:"array_join,omitempty"` // For ARRAY JOIN as table element
}

TablesInSelectQueryElement represents a single table element in a SELECT.

func (*TablesInSelectQueryElement) End

func (*TablesInSelectQueryElement) Pos

type TernaryExpr

type TernaryExpr struct {
	Position  token.Position `json:"-"`
	Condition Expression     `json:"condition"`
	Then      Expression     `json:"then"`
	Else      Expression     `json:"else"`
}

TernaryExpr represents a ternary conditional expression (cond ? then : else).

func (*TernaryExpr) End

func (t *TernaryExpr) End() token.Position

func (*TernaryExpr) Pos

func (t *TernaryExpr) Pos() token.Position

type TransactionControlQuery

type TransactionControlQuery struct {
	Position token.Position `json:"-"`
	Action   string         `json:"action"` // "BEGIN", "COMMIT", "ROLLBACK", "SET_SNAPSHOT"
	Snapshot int64          `json:"snapshot,omitempty"`
}

TransactionControlQuery represents a transaction control statement (BEGIN, COMMIT, ROLLBACK, SET TRANSACTION SNAPSHOT).

func (*TransactionControlQuery) End

func (*TransactionControlQuery) Pos

type TruncateQuery

type TruncateQuery struct {
	Position         token.Position `json:"-"`
	Temporary        bool           `json:"temporary,omitempty"`
	IfExists         bool           `json:"if_exists,omitempty"`
	TruncateDatabase bool           `json:"truncate_database,omitempty"` // True for TRUNCATE DATABASE
	Database         string         `json:"database,omitempty"`
	Table            string         `json:"table"`
	OnCluster        string         `json:"on_cluster,omitempty"`
	Settings         []*SettingExpr `json:"settings,omitempty"`
}

TruncateQuery represents a TRUNCATE statement.

func (*TruncateQuery) End

func (t *TruncateQuery) End() token.Position

func (*TruncateQuery) Pos

func (t *TruncateQuery) Pos() token.Position

type TupleAccess

type TupleAccess struct {
	Position token.Position `json:"-"`
	Tuple    Expression     `json:"tuple"`
	Index    Expression     `json:"index"`
}

TupleAccess represents tuple element access.

func (*TupleAccess) End

func (t *TupleAccess) End() token.Position

func (*TupleAccess) Pos

func (t *TupleAccess) Pos() token.Position

type UnaryExpr

type UnaryExpr struct {
	Position token.Position `json:"-"`
	Op       string         `json:"op"`
	Operand  Expression     `json:"operand"`
}

UnaryExpr represents a unary expression.

func (*UnaryExpr) End

func (u *UnaryExpr) End() token.Position

func (*UnaryExpr) Pos

func (u *UnaryExpr) Pos() token.Position

type UndropQuery

type UndropQuery struct {
	Position  token.Position `json:"-"`
	Database  string         `json:"database,omitempty"`
	Table     string         `json:"table"`
	OnCluster string         `json:"on_cluster,omitempty"`
	UUID      string         `json:"uuid,omitempty"`
	Format    string         `json:"format,omitempty"`
}

UndropQuery represents an UNDROP TABLE statement.

func (*UndropQuery) End

func (u *UndropQuery) End() token.Position

func (*UndropQuery) Pos

func (u *UndropQuery) Pos() token.Position

type UpdateQuery

type UpdateQuery struct {
	Position    token.Position `json:"-"`
	Database    string         `json:"database,omitempty"`
	Table       string         `json:"table"`
	Assignments []*Assignment  `json:"assignments"`
	Where       Expression     `json:"where,omitempty"`
}

UpdateQuery represents a standalone UPDATE statement. In ClickHouse, UPDATE is syntactic sugar for ALTER TABLE ... UPDATE

func (*UpdateQuery) End

func (u *UpdateQuery) End() token.Position

func (*UpdateQuery) Pos

func (u *UpdateQuery) Pos() token.Position

type UseQuery

type UseQuery struct {
	Position token.Position `json:"-"`
	Database string         `json:"database"`
}

UseQuery represents a USE statement.

func (*UseQuery) End

func (u *UseQuery) End() token.Position

func (*UseQuery) Pos

func (u *UseQuery) Pos() token.Position

type WhenClause

type WhenClause struct {
	Position  token.Position `json:"-"`
	Condition Expression     `json:"condition"`
	Result    Expression     `json:"result"`
}

WhenClause represents a WHEN clause in a CASE expression.

func (*WhenClause) End

func (w *WhenClause) End() token.Position

func (*WhenClause) Pos

func (w *WhenClause) Pos() token.Position

type WindowDefinition

type WindowDefinition struct {
	Position token.Position `json:"-"`
	Name     string         `json:"name"`
	Spec     *WindowSpec    `json:"spec"`
}

WindowDefinition represents a named window definition in the WINDOW clause.

func (*WindowDefinition) End

func (w *WindowDefinition) End() token.Position

func (*WindowDefinition) Pos

func (w *WindowDefinition) Pos() token.Position

type WindowFrame

type WindowFrame struct {
	Position   token.Position  `json:"-"`
	Type       WindowFrameType `json:"type"`
	StartBound *FrameBound     `json:"start"`
	EndBound   *FrameBound     `json:"end,omitempty"`
}

WindowFrame represents a window frame.

func (*WindowFrame) End

func (w *WindowFrame) End() token.Position

func (*WindowFrame) Pos

func (w *WindowFrame) Pos() token.Position

type WindowFrameType

type WindowFrameType string

WindowFrameType represents the type of window frame.

const (
	FrameRows   WindowFrameType = "ROWS"
	FrameRange  WindowFrameType = "RANGE"
	FrameGroups WindowFrameType = "GROUPS"
)

type WindowSpec

type WindowSpec struct {
	Position    token.Position    `json:"-"`
	Name        string            `json:"name,omitempty"`
	PartitionBy []Expression      `json:"partition_by,omitempty"`
	OrderBy     []*OrderByElement `json:"order_by,omitempty"`
	Frame       *WindowFrame      `json:"frame,omitempty"`
}

WindowSpec represents a window specification.

func (*WindowSpec) End

func (w *WindowSpec) End() token.Position

func (*WindowSpec) Pos

func (w *WindowSpec) Pos() token.Position

type WithElement

type WithElement struct {
	Position   token.Position `json:"-"`
	Name       string         `json:"name"`
	Query      Expression     `json:"query"`       // Subquery or Expression
	ScalarWith bool           `json:"scalar_with"` // True for "(expr) AS name" syntax, false for "name AS (SELECT ...)"
}

WithElement represents a WITH element (CTE).

func (*WithElement) End

func (w *WithElement) End() token.Position

func (*WithElement) Pos

func (w *WithElement) Pos() token.Position

Jump to

Keyboard shortcuts

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