Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 16 additions & 2 deletions ast/alter_index_statement.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,18 +28,32 @@ func (s *SelectiveXmlIndexPromotedPath) node() {}

// XmlNamespaces represents a WITH XMLNAMESPACES clause
type XmlNamespaces struct {
XmlNamespacesElements []*XmlNamespacesAliasElement
XmlNamespacesElements []XmlNamespacesElement
}

func (x *XmlNamespaces) node() {}

// XmlNamespacesElement is an interface for XML namespace elements
type XmlNamespacesElement interface {
xmlNamespacesElement()
}

// XmlNamespacesAliasElement represents an alias element in XMLNAMESPACES
type XmlNamespacesAliasElement struct {
Identifier *Identifier
String *StringLiteral
}

func (x *XmlNamespacesAliasElement) node() {}
func (x *XmlNamespacesAliasElement) node() {}
func (x *XmlNamespacesAliasElement) xmlNamespacesElement() {}

// XmlNamespacesDefaultElement represents a default element in XMLNAMESPACES
type XmlNamespacesDefaultElement struct {
String *StringLiteral
}

func (x *XmlNamespacesDefaultElement) node() {}
func (x *XmlNamespacesDefaultElement) xmlNamespacesElement() {}

// PartitionSpecifier represents a partition specifier
type PartitionSpecifier struct {
Expand Down
37 changes: 37 additions & 0 deletions ast/broker_priority_statement.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
package ast

// BrokerPriorityParameter represents a parameter in a BROKER PRIORITY statement.
type BrokerPriorityParameter struct {
IsDefaultOrAny string `json:"IsDefaultOrAny,omitempty"` // None, Default, Any
ParameterType string `json:"ParameterType,omitempty"` // PriorityLevel, ContractName, RemoteServiceName, LocalServiceName
ParameterValue *IdentifierOrValueExpression `json:"ParameterValue,omitempty"`
}

func (*BrokerPriorityParameter) node() {}

// CreateBrokerPriorityStatement represents CREATE BROKER PRIORITY statement.
type CreateBrokerPriorityStatement struct {
Name *Identifier `json:"Name,omitempty"`
BrokerPriorityParameters []*BrokerPriorityParameter `json:"BrokerPriorityParameters,omitempty"`
}

func (*CreateBrokerPriorityStatement) node() {}
func (*CreateBrokerPriorityStatement) statement() {}

// AlterBrokerPriorityStatement represents ALTER BROKER PRIORITY statement.
type AlterBrokerPriorityStatement struct {
Name *Identifier `json:"Name,omitempty"`
BrokerPriorityParameters []*BrokerPriorityParameter `json:"BrokerPriorityParameters,omitempty"`
}

func (*AlterBrokerPriorityStatement) node() {}
func (*AlterBrokerPriorityStatement) statement() {}

// DropBrokerPriorityStatement represents DROP BROKER PRIORITY statement.
type DropBrokerPriorityStatement struct {
Name *Identifier `json:"Name,omitempty"`
IsIfExists bool `json:"IsIfExists,omitempty"`
}

func (*DropBrokerPriorityStatement) node() {}
func (*DropBrokerPriorityStatement) statement() {}
20 changes: 19 additions & 1 deletion ast/create_simple_statements.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,30 @@ func (s *CreateDatabaseStatement) statement() {}

// CreateLoginStatement represents a CREATE LOGIN statement.
type CreateLoginStatement struct {
Name *Identifier `json:"Name,omitempty"`
Name *Identifier `json:"Name,omitempty"`
Source CreateLoginSource `json:"Source,omitempty"`
}

func (s *CreateLoginStatement) node() {}
func (s *CreateLoginStatement) statement() {}

// CreateLoginSource is an interface for login sources
type CreateLoginSource interface {
createLoginSource()
}

// ExternalCreateLoginSource represents FROM EXTERNAL PROVIDER source
type ExternalCreateLoginSource struct {
Options []PrincipalOption `json:"Options,omitempty"`
}

func (s *ExternalCreateLoginSource) createLoginSource() {}

// PrincipalOption is an interface for principal options (SID, TYPE, etc.)
type PrincipalOption interface {
principalOptionNode()
}

// ServiceContract represents a contract in CREATE/ALTER SERVICE.
type ServiceContract struct {
Name *Identifier `json:"Name,omitempty"`
Expand Down
6 changes: 4 additions & 2 deletions ast/create_user_statement.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,17 @@ type LiteralPrincipalOption struct {
Value ScalarExpression
}

func (o *LiteralPrincipalOption) userOptionNode() {}
func (o *LiteralPrincipalOption) userOptionNode() {}
func (o *LiteralPrincipalOption) principalOptionNode() {}

// IdentifierPrincipalOption represents an identifier-based user option
type IdentifierPrincipalOption struct {
OptionKind string
Identifier *Identifier
}

func (o *IdentifierPrincipalOption) userOptionNode() {}
func (o *IdentifierPrincipalOption) userOptionNode() {}
func (o *IdentifierPrincipalOption) principalOptionNode() {}

// DefaultSchemaPrincipalOption represents a default schema option
type DefaultSchemaPrincipalOption struct {
Expand Down
1 change: 1 addition & 0 deletions ast/cte.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package ast

// WithCtesAndXmlNamespaces represents the WITH clause containing CTEs and/or XML namespaces.
type WithCtesAndXmlNamespaces struct {
XmlNamespaces *XmlNamespaces `json:"XmlNamespaces,omitempty"`
CommonTableExpressions []*CommonTableExpression `json:"CommonTableExpressions,omitempty"`
ChangeTrackingContext ScalarExpression `json:"ChangeTrackingContext,omitempty"`
}
Expand Down
57 changes: 57 additions & 0 deletions ast/fulltext_stoplist_statement.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
package ast

// CreateFullTextStopListStatement represents CREATE FULLTEXT STOPLIST statement
type CreateFullTextStopListStatement struct {
Name *Identifier `json:"Name,omitempty"`
IsSystemStopList bool `json:"IsSystemStopList"`
DatabaseName *Identifier `json:"DatabaseName,omitempty"`
SourceStopListName *Identifier `json:"SourceStopListName,omitempty"`
Owner *Identifier `json:"Owner,omitempty"`
}

func (s *CreateFullTextStopListStatement) node() {}
func (s *CreateFullTextStopListStatement) statement() {}

// AlterFullTextStopListStatement represents ALTER FULLTEXT STOPLIST statement
type AlterFullTextStopListStatement struct {
Name *Identifier `json:"Name,omitempty"`
Action *FullTextStopListAction `json:"Action,omitempty"`
}

func (s *AlterFullTextStopListStatement) node() {}
func (s *AlterFullTextStopListStatement) statement() {}

// FullTextStopListAction represents an action in ALTER FULLTEXT STOPLIST
type FullTextStopListAction struct {
IsAdd bool `json:"IsAdd"`
IsAll bool `json:"IsAll"`
StopWord *StringLiteral `json:"StopWord,omitempty"`
LanguageTerm *IdentifierOrValueExpression `json:"LanguageTerm,omitempty"`
}

func (a *FullTextStopListAction) node() {}

// DropFullTextStopListStatement represents DROP FULLTEXT STOPLIST statement
type DropFullTextStopListStatement struct {
Name *Identifier `json:"Name,omitempty"`
IsIfExists bool `json:"IsIfExists"`
}

func (s *DropFullTextStopListStatement) node() {}
func (s *DropFullTextStopListStatement) statement() {}

// DropFullTextCatalogStatement represents DROP FULLTEXT CATALOG statement
type DropFullTextCatalogStatement struct {
Name *Identifier `json:"Name,omitempty"`
}

func (s *DropFullTextCatalogStatement) node() {}
func (s *DropFullTextCatalogStatement) statement() {}

// DropFulltextIndexStatement represents DROP FULLTEXT INDEX statement
type DropFulltextIndexStatement struct {
OnName *SchemaObjectName `json:"OnName,omitempty"`
}

func (s *DropFulltextIndexStatement) node() {}
func (s *DropFulltextIndexStatement) statement() {}
17 changes: 17 additions & 0 deletions ast/fulltext_table_reference.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package ast

// FullTextTableReference represents CONTAINSTABLE or FREETEXTTABLE in a FROM clause
type FullTextTableReference struct {
FullTextFunctionType string `json:"FullTextFunctionType,omitempty"` // Contains, FreeText
TableName *SchemaObjectName `json:"TableName,omitempty"`
Columns []*ColumnReferenceExpression `json:"Columns,omitempty"`
SearchCondition ScalarExpression `json:"SearchCondition,omitempty"`
TopN ScalarExpression `json:"TopN,omitempty"`
Language ScalarExpression `json:"Language,omitempty"`
PropertyName ScalarExpression `json:"PropertyName,omitempty"`
Alias *Identifier `json:"Alias,omitempty"`
ForPath bool `json:"ForPath"`
}

func (*FullTextTableReference) node() {}
func (*FullTextTableReference) tableReference() {}
13 changes: 13 additions & 0 deletions ast/partition_function_call.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package ast

// PartitionFunctionCall represents a $PARTITION function call.
// Syntax: [database.]$PARTITION.function(args)
type PartitionFunctionCall struct {
DatabaseName *Identifier `json:"DatabaseName,omitempty"`
SchemaName *Identifier `json:"SchemaName,omitempty"`
FunctionName *Identifier `json:"FunctionName,omitempty"`
Parameters []ScalarExpression `json:"Parameters,omitempty"`
}

func (*PartitionFunctionCall) node() {}
func (*PartitionFunctionCall) scalarExpression() {}
39 changes: 39 additions & 0 deletions ast/resource_pool_statement.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
package ast

// CreateResourcePoolStatement represents a CREATE RESOURCE POOL statement
type CreateResourcePoolStatement struct {
Name *Identifier `json:"Name,omitempty"`
ResourcePoolParameters []*ResourcePoolParameter `json:"ResourcePoolParameters,omitempty"`
}

func (*CreateResourcePoolStatement) node() {}
func (*CreateResourcePoolStatement) statement() {}

// AlterResourcePoolStatement represents an ALTER RESOURCE POOL statement
type AlterResourcePoolStatement struct {
Name *Identifier `json:"Name,omitempty"`
ResourcePoolParameters []*ResourcePoolParameter `json:"ResourcePoolParameters,omitempty"`
}

func (*AlterResourcePoolStatement) node() {}
func (*AlterResourcePoolStatement) statement() {}

// ResourcePoolParameter represents a parameter in a resource pool statement
type ResourcePoolParameter struct {
ParameterType string `json:"ParameterType,omitempty"` // MinCpuPercent, MaxCpuPercent, CapCpuPercent, MinMemoryPercent, MaxMemoryPercent, MinIoPercent, MaxIoPercent, CapIoPercent, Affinity, etc.
ParameterValue ScalarExpression `json:"ParameterValue,omitempty"`
AffinitySpecification *ResourcePoolAffinitySpecification `json:"AffinitySpecification,omitempty"`
}

// ResourcePoolAffinitySpecification represents an AFFINITY specification in a resource pool
type ResourcePoolAffinitySpecification struct {
AffinityType string `json:"AffinityType,omitempty"` // Scheduler, NumaNode
IsAuto bool `json:"IsAuto"`
PoolAffinityRanges []*LiteralRange `json:"PoolAffinityRanges,omitempty"`
}

// LiteralRange represents a range of values (e.g., 50 TO 60)
type LiteralRange struct {
From ScalarExpression `json:"From,omitempty"`
To ScalarExpression `json:"To,omitempty"`
}
14 changes: 14 additions & 0 deletions ast/rollup_grouping_specification.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,17 @@ type CompositeGroupingSpecification struct {

func (*CompositeGroupingSpecification) node() {}
func (*CompositeGroupingSpecification) groupingSpecification() {}

// GrandTotalGroupingSpecification represents empty parentheses () which means grand total.
type GrandTotalGroupingSpecification struct{}

func (*GrandTotalGroupingSpecification) node() {}
func (*GrandTotalGroupingSpecification) groupingSpecification() {}

// GroupingSetsGroupingSpecification represents GROUP BY GROUPING SETS (...) syntax.
type GroupingSetsGroupingSpecification struct {
Arguments []GroupingSpecification `json:"Arguments,omitempty"`
}

func (*GroupingSetsGroupingSpecification) node() {}
func (*GroupingSetsGroupingSpecification) groupingSpecification() {}
9 changes: 5 additions & 4 deletions ast/select_statement.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@ package ast

// SelectStatement represents a SELECT statement.
type SelectStatement struct {
QueryExpression QueryExpression `json:"QueryExpression,omitempty"`
Into *SchemaObjectName `json:"Into,omitempty"`
On *Identifier `json:"On,omitempty"`
OptimizerHints []OptimizerHintBase `json:"OptimizerHints,omitempty"`
QueryExpression QueryExpression `json:"QueryExpression,omitempty"`
Into *SchemaObjectName `json:"Into,omitempty"`
On *Identifier `json:"On,omitempty"`
OptimizerHints []OptimizerHintBase `json:"OptimizerHints,omitempty"`
WithCtesAndXmlNamespaces *WithCtesAndXmlNamespaces `json:"WithCtesAndXmlNamespaces,omitempty"`
}

func (*SelectStatement) node() {}
Expand Down
16 changes: 16 additions & 0 deletions ast/semantic_table_reference.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package ast

// SemanticTableReference represents SEMANTICKEYPHRASETABLE, SEMANTICSIMILARITYTABLE, or SEMANTICSIMILARITYDETAILSTABLE in a FROM clause
type SemanticTableReference struct {
SemanticFunctionType string `json:"SemanticFunctionType,omitempty"` // SemanticKeyPhraseTable, SemanticSimilarityTable, SemanticSimilarityDetailsTable
TableName *SchemaObjectName `json:"TableName,omitempty"`
Columns []*ColumnReferenceExpression `json:"Columns,omitempty"`
SourceKey ScalarExpression `json:"SourceKey,omitempty"`
MatchedColumn *ColumnReferenceExpression `json:"MatchedColumn,omitempty"`
MatchedKey ScalarExpression `json:"MatchedKey,omitempty"`
Alias *Identifier `json:"Alias,omitempty"`
ForPath bool `json:"ForPath"`
}

func (*SemanticTableReference) node() {}
func (*SemanticTableReference) tableReference() {}
8 changes: 8 additions & 0 deletions ast/table_hint.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,11 @@ type IndexTableHint struct {
}

func (*IndexTableHint) tableHint() {}

// LiteralTableHint represents a table hint with a literal value (e.g., SPATIAL_WINDOW_MAX_CELLS = 512).
type LiteralTableHint struct {
HintKind string `json:"HintKind,omitempty"`
Value ScalarExpression `json:"Value,omitempty"`
}

func (*LiteralTableHint) tableHint() {}
Loading
Loading