Documentation
¶
Overview ¶
* Copyright (c) 2023-present unTill Pro, Ltd. * @author Michael Saigachenko
* Copyright (c) 2023-present unTill Pro, Ltd. * @author Michael Saigachenko
* Copyright (c) 2023-present unTill Pro, Ltd. * @author Michael Saigachenko
* Copyright (c) 2023-present unTill Pro, Ltd. * @author Michael Saigachenko
* Copyright (c) 2023-present unTill Pro, Ltd. * @author Michael Saigachenko
* Copyright (c) 2023-present unTill Pro, Ltd. * @author Michael Saigachenko
Index ¶
- Constants
- Variables
- func BuildAppDefs(appSchema *AppSchemaAST, builder appdef.IAppDefBuilder, ...) error
- func CompareParam(left, right FunctionParam) bool
- func CompareParams(params []FunctionParam, f *FunctionStmt) error
- func ErrAbstractTableNotAlowedInProjectors(tblName string) error
- func ErrAppDoesNotDefineUseOfPackage(name string) error
- func ErrBytesFieldInCC(name string) error
- func ErrCheckRegexpErr(e error) error
- func ErrCouldNotImport(pkgName string) error
- func ErrFieldAlreadyInUnique(name string) error
- func ErrInvalidCronSchedule(schedule string) error
- func ErrLocalPackageNameRedeclared(localPkgName, newLocalPkgName string) error
- func ErrNestedAbstractTable(tblName string) error
- func ErrPackageRedeclared(name string) error
- func ErrProjectorDoesNotDeclareViewIntent(projectorName, viewName string) error
- func ErrRedefined(name string) error
- func ErrReferenceToAbstractTable(tblName string) error
- func ErrReferenceToTableNotInWorkspace(tblName string) error
- func ErrStorageNotInIntents(name string) error
- func ErrStorageNotInState(name string) error
- func ErrStorageRequiresEntity(name string) error
- func ErrTypeNotSupported(name string) error
- func ErrUndefined(name string) error
- func ErrUndefinedCommand(name DefQName) error
- func ErrUndefinedDataTypeOrTable(name DefQName) error
- func ErrUndefinedField(name string) error
- func ErrUndefinedQuery(name DefQName) error
- func ErrUndefinedRate(name DefQName) error
- func ErrUndefinedRole(name DefQName) error
- func ErrUndefinedTable(name DefQName) error
- func ErrUndefinedTag(name DefQName) error
- func ErrUndefinedType(name DefQName) error
- func ErrUndefinedTypeOrOdoc(name DefQName) error
- func ErrUndefinedTypeOrTable(name DefQName) error
- func ErrUndefinedWorkspace(name DefQName) error
- func ErrUnexpectedRootTableKind(kind int) error
- func ErrUseOfAbstractTable(tblName string) error
- func ErrUseOfAbstractWorkspace(wsName string) error
- func ErrVarcharFieldInCC(name string) error
- func ErrViewFieldBytes(name string) error
- func ErrViewFieldVarchar(name string) error
- func ErrWorkspaceIsNotAlterable(wsName string) error
- func GetQualifiedPackageName(pkgName Ident, schema *SchemaAST) string
- type AlterWorkspaceStmt
- type AnyOrVoidOrDef
- type AppSchemaAST
- type ApplicationStmt
- type Array
- type Between
- type Boolean
- type BuildAppDefsOption
- type CheckRegExp
- type CommandStmt
- type Compare
- type Condition
- type ConditionOperand
- type ConditionRHS
- type DataType
- type DataTypeOrDef
- type DeclareStmt
- type DefQName
- type EngineType
- type Expression
- type Factor
- type FieldExpr
- type FieldSetItem
- type FileSchemaAST
- type FunctionParam
- type FunctionStmt
- type GrantAllTablesWithTagAction
- type GrantAllTablesWithTagActions
- type GrantStmt
- type GrantTableAction
- type GrantTableActions
- type GrantTableAll
- type IExtensionStatement
- type INamedStatement
- type IStatement
- type IStatementCollection
- type IVariableResolver
- type Ident
- type Identifier
- type ImportStmt
- type In
- type Is
- type Like
- type LimitAction
- type LimitStmt
- type NamedParam
- type NestedTableStmt
- type Operand
- type OrCondition
- type PackageFS
- type PackageSchemaAST
- func BuildPackageSchema(path string, asts []*FileSchemaAST) (*PackageSchemaAST, error)
- func ParsePackageDir(path string, fs coreutils.IReadFS, subDir string) (ast *PackageSchemaAST, err error)
- func ParsePackageDirCollectingFiles(path string, fs coreutils.IReadFS, subDir string) (*PackageSchemaAST, []string, error)
- type PrimaryKeyExpr
- type ProjectionTableAction
- type ProjectorCommandAction
- type ProjectorStmt
- type ProjectorTrigger
- type QueryStmt
- type RateObjectScope
- type RateStmt
- type RateSubjectScope
- type RateValue
- type RateValueTimeUnit
- type RefFieldExpr
- type RoleStmt
- type RootExtEngineStatement
- type RootExtEngineStmt
- type RootStatement
- type SchemaAST
- type StateStorage
- type Statement
- type StorageOp
- type StorageScope
- type StorageStmt
- type SymbolRef
- type TableCheckExpr
- type TableConstraint
- type TableItemExpr
- type TableStmt
- type TagStmt
- type TemplateStmt
- type Term
- type TypeBytes
- type TypeStmt
- type TypeVarchar
- type UniqueExpr
- type UniqueFieldExpr
- type UseStmt
- type UseTableStmt
- type UseWorkspaceStmt
- type Value
- type ViewField
- type ViewItemExpr
- type ViewRefField
- type ViewStmt
- func (s ViewStmt) ClusteringColumns(callback func(f *ViewItemExpr))
- func (s ViewStmt) Field(fieldName Ident) *ViewItemExpr
- func (s ViewStmt) GetName() string
- func (s *ViewStmt) Iterate(callback func(stmt interface{}))
- func (s ViewStmt) PartitionFields(callback func(f *ViewItemExpr))
- func (s ViewStmt) ValueFields(callback func(f *ViewItemExpr))
- type VoidOrDataType
- type VoidOrDef
- type WithItem
- type WorkspaceExtEngineStatement
- type WorkspaceExtEngineStmt
- type WorkspaceStatement
- type WorkspaceStmt
- type WsDescriptorStmt
Constants ¶
const ExportedAppsFile = "apps.yaml"
const ExportedPkgFolder = "pkg"
const SqlExt = ".sql"
const VSqlExt = ".vsql"
Variables ¶
var ErrAbstractWorkspaceDescriptor = errors.New("abstract workspace cannot have a descriptor")
var ErrApplicationNotDefined = errors.New("application not defined")
var ErrApplicationRedefined = errors.New("redefinition of application")
var ErrBaseTableMustBeAbstract = errors.New("base table must be abstract")
var ErrBaseWorkspaceMustBeAbstract = errors.New("base workspace must be abstract")
var ErrCircularReferenceInInherits = errors.New("circular reference in INHERITS")
var ErrDirContainsNoSchemaFiles = errors.New("no schema files in directory")
var ErrEmptyFileAstList = errors.New("no valid schema files")
var ErrFunctionParamsIncorrect = errors.New("function parameters do not match")
var ErrFunctionResultIncorrect = errors.New("function result do not match")
var ErrInheritanceFromSysWorkspaceNotAllowed = errors.New("explicit inheritance from sys.Workspace not allowed")
var ErrMaxFieldLengthTooLarge = fmt.Errorf("maximum field length is %d", appdef.MaxFieldLength)
var ErrMustBeNotNull = errors.New("field has to be NOT NULL")
var ErrNestedTableIncorrectKind = errors.New("incorrect nested table kind")
var ErrNestedTablesNotSupportedInTypes = errors.New("nested tables not supported in types")
var ErrNoQualifiedName = errors.New("empty qualified name")
var ErrOnlyInsertForOdocOrORecord = errors.New("only INSERT allowed for ODoc or ORecord")
var ErrPackageWithSameNameAlreadyIncludedInApp = errors.New("package with the same name already included in application")
var ErrPkgFolderNotFound = errors.New("pkg folder not found")
var ErrPrimaryKeyNotDefined = errors.New("primary key not defined")
var ErrPrimaryKeyRedefined = errors.New("redefinition of primary key")
var ErrRegexpCheckOnlyForVarcharField = errors.New("regexp CHECK only available for varchar field")
var ErrScheduledProjectorNotInAppWorkspace = errors.New("scheduled projector must be in app workspace")
var ErrScheduledProjectorWithIntents = errors.New("scheduled projector cannot have intents")
var ErrStorageDeclaredOnlyInSys = errors.New("storages are only declared in sys package")
var ErrSysWorkspaceNotFound = errors.New("sys.Workspace type not found")
var ErrUndefinedTableKind = errors.New("undefined table kind")
Functions ¶
func BuildAppDefs ¶
func BuildAppDefs(appSchema *AppSchemaAST, builder appdef.IAppDefBuilder, opts ...BuildAppDefsOption) error
func CompareParam ¶
func CompareParam(left, right FunctionParam) bool
func CompareParams ¶
func CompareParams(params []FunctionParam, f *FunctionStmt) error
func ErrBytesFieldInCC ¶
func ErrCheckRegexpErr ¶
func ErrCouldNotImport ¶
Golang: could not import github.com/alecthomas/participle/v2/asd (no required module provides package "github.com/alecthomas/participle/v2/asd")
func ErrFieldAlreadyInUnique ¶
func ErrInvalidCronSchedule ¶
func ErrNestedAbstractTable ¶
func ErrPackageRedeclared ¶
func ErrRedefined ¶
func ErrStorageNotInIntents ¶
func ErrStorageNotInState ¶
func ErrTypeNotSupported ¶
func ErrUndefined ¶
func ErrUndefinedCommand ¶
func ErrUndefinedField ¶
func ErrUndefinedQuery ¶
func ErrUndefinedRate ¶
func ErrUndefinedRole ¶
func ErrUndefinedTable ¶
func ErrUndefinedTag ¶
func ErrUndefinedType ¶
func ErrUndefinedTypeOrOdoc ¶
func ErrUndefinedTypeOrTable ¶
func ErrUndefinedWorkspace ¶
func ErrUseOfAbstractTable ¶
func ErrVarcharFieldInCC ¶
func ErrViewFieldBytes ¶
func ErrViewFieldVarchar ¶
func GetQualifiedPackageName ¶
Types ¶
type AlterWorkspaceStmt ¶
type AlterWorkspaceStmt struct { Statement Name DefQName `parser:"'ALTER' 'WORKSPACE' @@ "` A int `parser:"'('"` Statements []WorkspaceStatement `parser:"@@? (';' @@)* ';'? ')'"` // contains filtered or unexported fields }
func (*AlterWorkspaceStmt) Iterate ¶
func (s *AlterWorkspaceStmt) Iterate(callback func(stmt interface{}))
type AnyOrVoidOrDef ¶
type AppSchemaAST ¶
type AppSchemaAST struct { // Application name Name string // key = Fully Qualified Name Packages map[string]*PackageSchemaAST LocalNameToFullPath map[string]string }
func BuildAppSchema ¶
func BuildAppSchema(packages []*PackageSchemaAST) (*AppSchemaAST, error)
Application-level semantic analysis (e.g. cross-package references)
type ApplicationStmt ¶
type ApplicationStmt struct { Statement Name Ident `parser:"'APPLICATION' @Ident '('"` Uses []UseStmt `parser:"@@? (';' @@)* ';'? ')'"` }
func FindApplication ¶
func FindApplication(p *PackageSchemaAST) (result *ApplicationStmt, err error)
type Array ¶
type Array struct {
Expressions []*Expression `parser:"'(' @@ ( ',' @@ )* ')'"`
}
type BuildAppDefsOption ¶
type BuildAppDefsOption = func(*buildContext)
BuildAppDefsOption is a function that can be passed to BuildAppDefs to configure it.
func WithVariableResolver ¶
func WithVariableResolver(resolver IVariableResolver) BuildAppDefsOption
type CheckRegExp ¶
type CommandStmt ¶
type CommandStmt struct { Statement Name Ident `parser:"'COMMAND' @Ident"` Param *AnyOrVoidOrDef `parser:"('(' @@? "` UnloggedParam *AnyOrVoidOrDef `parser:"(','? UNLOGGED @@)? ')')?"` State []StateStorage `parser:"('STATE' '(' @@ (',' @@)* ')' )?"` Intents []StateStorage `parser:"('INTENTS' '(' @@ (',' @@)* ')' )?"` Returns *AnyOrVoidOrDef `parser:"('RETURNS' @@)?"` With []WithItem `parser:"('WITH' @@ (',' @@)* )?"` Engine EngineType // Initialized with 1st pass }
func (*CommandStmt) GetName ¶
func (s *CommandStmt) GetName() string
func (*CommandStmt) SetEngineType ¶
func (s *CommandStmt) SetEngineType(e EngineType)
type Condition ¶
type Condition struct { Operand *ConditionOperand `parser:" @@"` Not *Condition `parser:"| 'NOT' @@"` }
type ConditionOperand ¶
type ConditionOperand struct { Operand *Operand `parser:"@@"` ConditionRHS *ConditionRHS `parser:"@@?"` }
type ConditionRHS ¶
type DataType ¶
type DataType struct { Varchar *TypeVarchar `parser:"( @@"` Bytes *TypeBytes `parser:"| @@"` Int32 bool `parser:"| @('integer' | 'int' | 'int32')"` Int64 bool `parser:"| @('bigint' | 'int64')"` Float32 bool `parser:"| @('real' | 'float' | 'float32')"` Float64 bool `parser:"| @(('double' 'precision') | 'float64')"` Timestamp bool `parser:"| @'timestamp'"` Currency bool `parser:"| @('money' | 'currency')"` Bool bool `parser:"| @('boolean' | 'bool')"` Blob bool `parser:"| @(('binary' 'large' 'object') | 'blob')"` QName bool `parser:"| @(('qualified' 'name') | 'qname')"` Record bool `parser:"| @'record' )"` }
type DataTypeOrDef ¶
type DataTypeOrDef struct { DataType *DataType `parser:"( @@"` Def *DefQName `parser:"| @@ )"` // contains filtered or unexported fields }
func (DataTypeOrDef) String ¶
func (q DataTypeOrDef) String() (s string)
type DeclareStmt ¶
type DeclareStmt struct { Statement Name Ident `parser:"'DECLARE' @Ident"` DataType string `parser:"@('int' | 'int32')"` DefaultValue *int `parser:"'DEFAULT' @Int"` }
func (DeclareStmt) GetName ¶
func (s DeclareStmt) GetName() string
type DefQName ¶
type EngineType ¶
type Expression ¶
type Expression struct {
Or []*OrCondition `parser:"@@ ( 'OR' @@ )*"`
}
type FieldExpr ¶
type FieldExpr struct { Statement Name Ident `parser:"@Ident"` Type DataTypeOrDef `parser:"@@"` NotNull bool `parser:"@(NOTNULL)?"` Verifiable bool `parser:"@('VERIFIABLE')?"` DefaultIntValue *int `parser:"('DEFAULT' @Int)?"` DefaultStringValue *string `parser:"('DEFAULT' @String)?"` // DefaultNextVal *string `parser:"(DEFAULTNEXTVAL '(' @String ')')?"` CheckRegexp *CheckRegExp `parser:"('CHECK' @@ )?"` CheckExpression *Expression `parser:"('CHECK' '(' @@ ')')? "` }
type FieldSetItem ¶
type FileSchemaAST ¶
func ParseFile ¶
func ParseFile(fileName, content string) (*FileSchemaAST, error)
ParseFile parses content of the single file, creates FileSchemaAST and returns pointer to it. Performs syntax analysis
type FunctionParam ¶
type FunctionParam struct { NamedParam *NamedParam `parser:"@@"` UnnamedParamType *DataTypeOrDef `parser:"| @@"` }
type FunctionStmt ¶
type FunctionStmt struct { Statement Name Ident `parser:"'FUNCTION' @Ident"` Params []FunctionParam `parser:"'(' @@? (',' @@)* ')'"` Returns DataTypeOrDef `parser:"'RETURNS' @@"` Engine EngineType // Initialized with 1st pass }
func (*FunctionStmt) GetName ¶
func (s *FunctionStmt) GetName() string
func (*FunctionStmt) SetEngineType ¶
func (s *FunctionStmt) SetEngineType(e EngineType)
type GrantAllTablesWithTagActions ¶
type GrantAllTablesWithTagActions struct { Pos lexer.Position GrantAll bool `parser:"@'ALL' | "` Items []GrantAllTablesWithTagAction `parser:"(@@ (',' @@)*)"` }
type GrantStmt ¶
type GrantStmt struct { Statement Command bool `parser:"'GRANT' ( @INSERTONCOMMAND"` AllCommandsWithTag bool `parser:"| @INSERTONALLCOMMANDSWITHTAG"` Query bool `parser:"| @SELECTONQUERY"` AllQueriesWithTag bool `parser:"| @SELECTONALLQUERIESWITHTAG"` Workspace bool `parser:"| @INSERTONWORKSPACE"` AllWorkspacesWithTag bool `parser:"| @INSERTONALLWORKSPACESWITHTAG"` AllTablesWithTag *GrantAllTablesWithTagActions `parser:"| (@@ ONALLTABLESWITHTAG)"` Table *GrantTableActions `parser:"| (@@ ONTABLE) )"` On DefQName `parser:"@@"` To DefQName `parser:"'TO' @@"` }
type GrantTableAction ¶
type GrantTableActions ¶
type GrantTableActions struct { Pos lexer.Position GrantAll *GrantTableAll `parser:"(@@ | "` Items []GrantTableAction `parser:"(@@ (',' @@)*))"` }
type GrantTableAll ¶
type GrantTableAll struct { Pos lexer.Position GrantAll bool `parser:"@'ALL'"` Columns []Identifier `parser:"( '(' @@ (',' @@)* ')' )?"` }
type IExtensionStatement ¶
type IExtensionStatement interface {
SetEngineType(EngineType)
}
type INamedStatement ¶
type INamedStatement interface { IStatement GetName() string }
type IStatement ¶
type IStatementCollection ¶
type IStatementCollection interface {
Iterate(callback func(stmt interface{}))
}
type IVariableResolver ¶
type Identifier ¶
type ImportStmt ¶
type In ¶
type In struct {
Expressions []*Expression `parser:"@@ ( ',' @@ )*"`
}
type LimitAction ¶
type LimitStmt ¶
type LimitStmt struct { Statement Name Ident `parser:"'LIMIT' @Ident"` Action LimitAction `parser:"@@"` RateName DefQName `parser:"'WITH' 'RATE' @@"` }
type NamedParam ¶
type NamedParam struct { Name Ident `parser:"@Ident"` Type DataTypeOrDef `parser:"@@"` }
type NestedTableStmt ¶
type OrCondition ¶
type OrCondition struct {
And []*Condition `parser:"@@ ( 'AND' @@ )*"`
}
type PackageSchemaAST ¶
type PackageSchemaAST struct { Name string // Fill on the analysis stage, when the APPLICATION statement is found Path string Ast *SchemaAST }
func BuildPackageSchema ¶
func BuildPackageSchema(path string, asts []*FileSchemaAST) (*PackageSchemaAST, error)
BuildPackageSchema merges File Schema ASTs into Package Schema AST. Performs package-level semantic analysis
func ParsePackageDir ¶
func ParsePackageDir(path string, fs coreutils.IReadFS, subDir string) (ast *PackageSchemaAST, err error)
ParsePackageDir is a helper which parses all SQL schemas from specified FS and returns Package Schema.
func ParsePackageDirCollectingFiles ¶
func ParsePackageDirCollectingFiles(path string, fs coreutils.IReadFS, subDir string) (*PackageSchemaAST, []string, error)
ParsePackageDirCollectingFiles is a helper which parses all SQL schemas from specified FS Returns package schema and list of schema file names which were parsed
type PrimaryKeyExpr ¶
type PrimaryKeyExpr struct { Pos lexer.Position PartitionKeyFields []Identifier `parser:"('(' @@ (',' @@)* ')')?"` ClusteringColumnsFields []Identifier `parser:"(','? @@ (',' @@)*)?"` }
type ProjectionTableAction ¶
type ProjectorCommandAction ¶
type ProjectorStmt ¶
type ProjectorStmt struct { Statement Sync bool `parser:"@'SYNC'?"` Name Ident `parser:"'PROJECTOR' @Ident"` Triggers []ProjectorTrigger `parser:"@@ ('OR' @@)*"` State []StateStorage `parser:"('STATE' '(' @@ (',' @@)* ')' )?"` Intents []StateStorage `parser:"('INTENTS' '(' @@ (',' @@)* ')' )?"` IncludingErrors bool `parser:"@('INCLUDING' 'ERRORS')?"` Engine EngineType // Initialized with 1st pass }
func (*ProjectorStmt) GetName ¶
func (s *ProjectorStmt) GetName() string
func (*ProjectorStmt) SetEngineType ¶
func (s *ProjectorStmt) SetEngineType(e EngineType)
type ProjectorTrigger ¶
type ProjectorTrigger struct { CronSchedule *string `parser:"('CRON' @String) | ("` ExecuteAction *ProjectorCommandAction `parser:"'AFTER' (@@"` TableActions []ProjectionTableAction `parser:"| (@@ ('OR' @@)* ))"` QNames []DefQName `parser:"'ON' (('(' @@ (',' @@)* ')') | @@)!)"` // contains filtered or unexported fields }
type QueryStmt ¶
type QueryStmt struct { Statement Name Ident `parser:"'QUERY' @Ident"` Param *AnyOrVoidOrDef `parser:"('(' @@? ')')?"` State []StateStorage `parser:"('STATE' '(' @@ (',' @@)* ')' )?"` Returns AnyOrVoidOrDef `parser:"'RETURNS' @@"` With []WithItem `parser:"('WITH' @@ (',' @@)* )?"` Engine EngineType // Initialized with 1st pass }
func (*QueryStmt) SetEngineType ¶
func (s *QueryStmt) SetEngineType(e EngineType)
type RateObjectScope ¶
type RateStmt ¶
type RateStmt struct { Statement Name Ident `parser:"'RATE' @Ident"` Value RateValue `parser:"@@"` ObjectScope *RateObjectScope `parser:"@@?"` SubjectScope *RateSubjectScope `parser:"@@?"` }
type RateSubjectScope ¶
type RateValue ¶
type RateValue struct { Count *int `parser:"(@Int"` Variable *DefQName `parser:"| @@) 'PER'"` TimeUnitAmounts *int `parser:"@Int?"` TimeUnit RateValueTimeUnit `parser:"@@"` // contains filtered or unexported fields }
type RateValueTimeUnit ¶
type RefFieldExpr ¶
type RootExtEngineStatement ¶
type RootExtEngineStatement struct { Function *FunctionStmt `parser:"@@"` Storage *StorageStmt `parser:"| @@"` // contains filtered or unexported fields }
type RootExtEngineStmt ¶
type RootExtEngineStmt struct { Engine EngineType `parser:"EXTENSIONENGINE @@"` Statements []RootExtEngineStatement `parser:"'(' @@? (';' @@)* ';'? ')'"` }
func (*RootExtEngineStmt) Iterate ¶
func (s *RootExtEngineStmt) Iterate(callback func(stmt interface{}))
type RootStatement ¶
type RootStatement struct { // Only allowed in root Template *TemplateStmt `parser:"@@"` // Also allowed in root Role *RoleStmt `parser:"| @@"` Rate *RateStmt `parser:"| @@"` Limit *LimitStmt `parser:"| @@"` Tag *TagStmt `parser:"| @@"` ExtEngine *RootExtEngineStmt `parser:"| @@"` Workspace *WorkspaceStmt `parser:"| @@"` AlterWorkspace *AlterWorkspaceStmt `parser:"| @@"` Table *TableStmt `parser:"| @@"` Type *TypeStmt `parser:"| @@"` Application *ApplicationStmt `parser:"| @@"` Declare *DeclareStmt `parser:"| @@"` // contains filtered or unexported fields }
type SchemaAST ¶
type SchemaAST struct { Imports []ImportStmt `parser:"@@? (';' @@)* ';'?"` Statements []RootStatement `parser:"@@? (';' @@)* ';'?"` }
type StateStorage ¶
type Statement ¶
type Statement struct { Pos lexer.Position RawCommentBlocks []string `parser:"@PreStmtComment*"` Comments []string // will be set after 1st pass }
func (*Statement) GetComments ¶
func (*Statement) GetRawCommentBlocks ¶
func (*Statement) SetComments ¶
type StorageScope ¶
type StorageStmt ¶
type StorageStmt struct { Statement Name Ident `parser:"'STORAGE' @Ident"` Ops []StorageOp `parser:"'(' @@ (',' @@)* ')'"` EntityRecord bool `parser:"@('ENTITY' 'RECORD')?"` EntityView bool `parser:"@('ENTITY' 'VIEW')?"` }
func (StorageStmt) GetName ¶
func (s StorageStmt) GetName() string
type SymbolRef ¶
type SymbolRef struct { Name DefQName `parser:"@@"` Parameters []*Expression `parser:"( '(' @@ ( ',' @@ )* ')' )?"` }
type TableCheckExpr ¶
type TableCheckExpr struct {
Expression Expression `parser:"'CHECK' '(' @@ ')'"`
}
type TableConstraint ¶
type TableConstraint struct { Statement ConstraintName Ident `parser:"('CONSTRAINT' @Ident)?"` UniqueField *UniqueFieldExpr `parser:"(@@"` Unique *UniqueExpr `parser:"| @@"` Check *TableCheckExpr `parser:"| @@)"` }
type TableItemExpr ¶
type TableItemExpr struct { NestedTable *NestedTableStmt `parser:"@@"` Constraint *TableConstraint `parser:"| @@"` RefField *RefFieldExpr `parser:"| @@"` Field *FieldExpr `parser:"| @@"` FieldSet *FieldSetItem `parser:"| @@"` }
type TableStmt ¶
type TableStmt struct { Statement Abstract bool `parser:"@'ABSTRACT'?'TABLE'"` Name Ident `parser:"@Ident"` Inherits *DefQName `parser:"('INHERITS' @@)?"` Items []TableItemExpr `parser:"'(' @@? (',' @@)* ')'"` With []WithItem `parser:"('WITH' @@ (',' @@)* )?"` // contains filtered or unexported fields }
type TemplateStmt ¶
type TemplateStmt struct { Statement Name Ident `parser:"'TEMPLATE' @Ident 'OF' 'WORKSPACE'" ` Workspace DefQName `parser:"@@"` Source Ident `parser:"'SOURCE' @Ident"` }
func (TemplateStmt) GetName ¶
func (s TemplateStmt) GetName() string
type Term ¶
type Term struct { Value *Value `parser:"@@"` SymbolRef *SymbolRef `parser:"| @@"` SubExpression *Expression `parser:"| '(' @@ ')'"` }
type TypeStmt ¶
type TypeStmt struct { Statement Name Ident `parser:"'TYPE' @Ident "` Items []TableItemExpr `parser:"'(' @@? (',' @@)* ')'"` }
type TypeVarchar ¶
type UniqueExpr ¶
type UniqueExpr struct {
Fields []Ident `parser:"'UNIQUE' '(' @Ident (',' @Ident)* ')'"`
}
type UniqueFieldExpr ¶
type UniqueFieldExpr struct {
Field Ident `parser:"'UNIQUEFIELD' @Ident"`
}
type UseTableStmt ¶
type UseTableStmt struct { Statement Package *Identifier `parser:"'USE' 'TABLE' (@@ '.')?"` AllTables bool `parser:"(@'*'"` TableName *Identifier `parser:"| @@)"` // contains filtered or unexported fields }
type UseWorkspaceStmt ¶
type UseWorkspaceStmt struct { Statement Workspace Identifier `parser:"'USE' 'WORKSPACE' @@"` // contains filtered or unexported fields }
type ViewField ¶
type ViewField struct { Statement Name Identifier `parser:"@@"` Type DataType `parser:"@@"` NotNull bool `parser:"@(NOTNULL)?"` }
type ViewItemExpr ¶
type ViewItemExpr struct { Pos lexer.Position PrimaryKey *PrimaryKeyExpr `parser:"(PRIMARYKEY '(' @@ ')')"` RefField *ViewRefField `parser:"| @@"` Field *ViewField `parser:"| @@"` }
type ViewRefField ¶
type ViewRefField struct { Statement Name Identifier `parser:"@@"` RefDocs []DefQName `parser:"'ref' ('(' @@ (',' @@)* ')')?"` NotNull bool `parser:"@(NOTNULL)?"` // contains filtered or unexported fields }
type ViewStmt ¶
type ViewStmt struct { Statement Name Ident `parser:"'VIEW' @Ident"` Items []ViewItemExpr `parser:"'(' @@? (',' @@)* ')'"` ResultOf DefQName `parser:"'AS' 'RESULT' 'OF' @@"` // contains filtered or unexported fields }
func (ViewStmt) ClusteringColumns ¶
func (s ViewStmt) ClusteringColumns(callback func(f *ViewItemExpr))
Iterate view clustering columns
func (ViewStmt) Field ¶
func (s ViewStmt) Field(fieldName Ident) *ViewItemExpr
Returns view item with field by field name
func (ViewStmt) PartitionFields ¶
func (s ViewStmt) PartitionFields(callback func(f *ViewItemExpr))
Iterate view partition fields
func (ViewStmt) ValueFields ¶
func (s ViewStmt) ValueFields(callback func(f *ViewItemExpr))
Iterate view value fields
type VoidOrDataType ¶
type VoidOrDataType struct { Void bool `parser:"( @'void'"` DataType *DataTypeOrDef `parser:"| @@)"` }
type WorkspaceExtEngineStatement ¶
type WorkspaceExtEngineStatement struct { Function *FunctionStmt `parser:"@@"` Projector *ProjectorStmt `parser:"| @@"` Command *CommandStmt `parser:"| @@"` Query *QueryStmt `parser:"| @@"` // contains filtered or unexported fields }
type WorkspaceExtEngineStmt ¶
type WorkspaceExtEngineStmt struct { Engine EngineType `parser:"EXTENSIONENGINE @@"` Statements []WorkspaceExtEngineStatement `parser:"'(' @@? (';' @@)* ';'? ')'"` }
func (*WorkspaceExtEngineStmt) Iterate ¶
func (s *WorkspaceExtEngineStmt) Iterate(callback func(stmt interface{}))
type WorkspaceStatement ¶
type WorkspaceStatement struct { // Only allowed in workspace Rate *RateStmt `parser:"@@"` View *ViewStmt `parser:"| @@"` UseTable *UseTableStmt `parser:"| @@"` UseWorkspace *UseWorkspaceStmt `parser:"| @@"` // Also allowed in workspace Role *RoleStmt `parser:"| @@"` Tag *TagStmt `parser:"| @@"` ExtEngine *WorkspaceExtEngineStmt `parser:"| @@"` Workspace *WorkspaceStmt `parser:"| @@"` Table *TableStmt `parser:"| @@"` Type *TypeStmt `parser:"| @@"` Limit *LimitStmt `parser:"| @@"` // Sequence *sequenceStmt `parser:"| @@"` Grant *GrantStmt `parser:"| @@"` // contains filtered or unexported fields }
type WorkspaceStmt ¶
type WorkspaceStmt struct { Statement Abstract bool `parser:"(@'ABSTRACT' "` Alterable bool `parser:"| @'ALTERABLE')?"` Pool bool `parser:"@('POOL' 'OF')?"` Name Ident `parser:"'WORKSPACE' @Ident "` Inherits []DefQName `parser:"('INHERITS' @@ (',' @@)* )? '('"` Descriptor *WsDescriptorStmt `parser:"('DESCRIPTOR' @@)?"` Statements []WorkspaceStatement `parser:"@@? (';' @@)* ';'? ')'"` // contains filtered or unexported fields }
func (WorkspaceStmt) GetName ¶
func (s WorkspaceStmt) GetName() string
func (*WorkspaceStmt) Iterate ¶
func (s *WorkspaceStmt) Iterate(callback func(stmt interface{}))
type WsDescriptorStmt ¶
type WsDescriptorStmt struct { Statement Name Ident `parser:"@Ident?"` Items []TableItemExpr `parser:"'(' @@? (',' @@)* ')'"` // contains filtered or unexported fields }
func (WsDescriptorStmt) GetName ¶
func (s WsDescriptorStmt) GetName() string