dparser

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Nov 26, 2022 License: MIT Imports: 6 Imported by: ? modules, 0 packages

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

Documentation

Index

Constants

View Source
const RootScopeName = "<root>"

Variables

This section is empty.

Functions

func SortIndexTargetTable

func SortIndexTargetTable(tables []*IndexTargetTable)

Types

type ColumnSchema

type ColumnSchema struct {
	Name string
}

type Field

type Field struct {
	AsName  string
	Columns []*FieldColumn
}

func (*Field) Name

func (f *Field) Name() string

type FieldColumn

type FieldColumn struct {
	// internal name to link with parent scope
	ReferenceName string

	Table string
	Name  string
	Type  FieldType
}

type FieldType

type FieldType int
const (
	FieldReference FieldType = iota
	FieldCondition
	FieldAggregation
	FieldSubquery
	FieldStar
)

type IndexField

type IndexField struct {
	Name string
	Type FieldType
}

type IndexTargetBuilder

type IndexTargetBuilder struct {
	// contains filtered or unexported fields
}

func NewIndexTargetBuilder

func NewIndexTargetBuilder(tablesSchemas []*TableSchema) *IndexTargetBuilder

func (*IndexTargetBuilder) Build

func (itb *IndexTargetBuilder) Build(scopes []*StmtScope) ([]*dmodel.IndexTarget, error)

type IndexTargetTable

type IndexTargetTable struct {
	TableName   string
	IndexFields []*IndexField
}

func (*IndexTargetTable) String

func (itt *IndexTargetTable) String() string

func (*IndexTargetTable) ToIndexTarget

func (itt *IndexTargetTable) ToIndexTarget() *dmodel.IndexTarget

type StmtScope

type StmtScope struct {
	Name        string
	Fields      []*Field
	FieldScopes []*StmtScope
	Tables      []*Table
	SubScopes   []*StmtScope
	CTEs        map[string]*StmtScope
}

func (*StmtScope) ListAsTableMap

func (ss *StmtScope) ListAsTableMap() map[string]*lib.Set[string]

type Table

type Table struct {
	AsName    string
	Name      string
	IsLateral bool
}

func (*Table) AsOrName

func (t *Table) AsOrName() string

type TableSchema

type TableSchema struct {
	Name        string
	Columns     []*ColumnSchema
	PrimaryKeys []string
}

func CreateTableSchemas

func CreateTableSchemas[T any](tables []string, vals []T, f func(T) (string, string, bool)) []*TableSchema

func (*TableSchema) TableDescription

func (ts *TableSchema) TableDescription() string

Jump to

Keyboard shortcuts

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