types

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: May 1, 2024 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

Functions

This section is empty.

Types

type Alter

type Alter struct {
	Type Statement `json:"type"`
	// Table []From    `json:"table"`
	Expr any `json:"expr"`
}

type BaseFrom added in v0.8.0

type BaseFrom struct {
	DB     *string `json:"db,omitempty"`
	Schema *string `json:"schema,omitempty"`
	As     *string `json:"as,omitempty"`
	Table  string  `json:"table"`
}

type Create

type Create struct {
	Type      Statement `json:"type"`
	Keyword   string    `json:"keyword"`
	Temporary string    `json:"temporary"`
	Table     []struct {
		DB    string `json:"db"`
		Table string `json:"table"`
	} `json:"table"`
	IfNotExists string `json:"if_not_exists"`
	Like        struct {
		Type        string `json:"type"`
		Table       string `json:"table"`
		Parentheses bool   `json:"parentheses"`
	} `json:"like"`
	IgnoreReplace     string `json:"ignore_replace"`
	As                string `json:"as"`
	QueryExpr         any    `json:"query_expr"`
	CreateDefinitions []any  `json:"create_definitions"`
	TableOptions      []any  `json:"table_options"`
	IndexUsing        struct {
		Keyword string `json:"keyword"`
		Type    string `json:"type"`
	} `json:"index_using"`
	Index           string `json:"index"`
	OnKw            string `json:"on_kw"`
	IndexColumns    []any  `json:"index_columns"`
	IndexType       string `json:"index_type"`
	IndexOptions    []any  `json:"index_options"`
	AlgorithmOption struct {
		Type      string `json:"type"`
		Keyword   string `json:"keyword"`
		Resource  string `json:"resource"`
		Symbol    string `json:"symbol"`
		Algorithm string `json:"algorithm"`
	} `json:"algorithm_option"`
	LockOption struct {
		Type     string `json:"type"`
		Keyword  string `json:"keyword"`
		Resource string `json:"resource"`
		Symbol   string `json:"symbol"`
		Lock     string `json:"lock"`
	} `json:"lock_option"`
	Database string `json:"database"`
}

type Delete

type Delete struct {
	Type  Statement `json:"type"`
	Table any       `json:"table"`
	From  []any     `json:"from"`
	Where any       `json:"where"`
}

type Drop

type Drop struct {
	Type    Statement `json:"type"`
	Keyword string    `json:"keyword"`
	Name    []any     `json:"name"`
}

type Dual added in v0.8.0

type Dual struct {
	Type string `json:"type"`
}

type From added in v0.8.0

type From struct {
	BaseFrom
	Join      *Join      `json:"join,omitempty"`
	TableExpr *TableExpr `json:"tableExpr,omitempty"`
	Dual      *Dual      `json:"dual,omitempty"`
}

type Insert

type Insert struct {
	Type    Statement     `json:"type"`
	DB      string        `json:"db"`
	Table   any           `json:"table"`
	Columns []any         `json:"columns,omitempty"`
	Values  []InsertValue `json:"values"`
}

type InsertValue

type InsertValue struct {
	Type  string `json:"type"`
	Value []any  `json:"value"`
}

type Join added in v0.8.0

type Join struct {
	BaseFrom
	Join  string   `json:"join"`
	Using []string `json:"using,omitempty"`
	On    any      `json:"on,omitempty"`
}

type Option

type Option struct {
	StatementPath []any
	Database      *string       `json:"database,omitempty"`
	Type          *string       `json:"type,omitempty"`
	TrimQuery     *bool         `json:"trimQuery,omitempty"`
	ParseOptions  *ParseOptions `json:"parseOptions,omitempty"`
}

func (*Option) SetDatabase

func (o *Option) SetDatabase(db string)

func (*Option) SetParseOptions

func (o *Option) SetParseOptions(po *ParseOptions)

func (*Option) SetStatementPath added in v0.9.0

func (o *Option) SetStatementPath(sp []any)

func (*Option) SetTrimQuery

func (o *Option) SetTrimQuery(b bool)

func (*Option) SetType

func (o *Option) SetType(t string)

func (*Option) ToMap

func (o *Option) ToMap() (map[string]any, error)

type ParseOptions

type ParseOptions struct {
	IncludeLocations bool `json:"includeLocations,omitempty"`
}

type Replace

type Replace struct {
	Type    Statement      `json:"type"`
	DB      string         `json:"db"`
	Table   any            `json:"table"`
	Columns []string       `json:"columns"`
	Values  []ReplaceValue `json:"values"`
}

type ReplaceValue

type ReplaceValue struct {
	Type  string `json:"type"`
	Value []any  `json:"value"`
}

type Select

type Select struct {
	Type     Statement   `json:"type"`
	With     *SelectWith `json:"with"`
	Options  []any       `json:"options"`
	Distinct any         `json:"distinct"`
	Columns  []any       `json:"columns"`
	From     *SelectFrom `json:"from"`
	Where    any         `json:"where"`
	// Groupby            []ColumnRef `json:"groupby"`
	Having []any `json:"having"`
	// Orderby            []OrderBy  `json:"orderby"`
	// Limit Limit `json:"limit"`
	// Orderby_           []OrderBy  `json:"_orderby"`
	// Limit_            Limit `json:"_limit"`
	ParenthesesSymbol bool `json:"parentheses_symbol"`
	Parentheses       bool `json:"_parentheses"`
}

type SelectFrom added in v0.8.0

type SelectFrom []From

type SelectWith added in v0.9.0

type SelectWith []With

type Statement

type Statement string
const (
	UnknownStatement Statement = ""
	UseStatement     Statement = "use"
	SelectStatement  Statement = "select"
	InsertStatement  Statement = "insert"
	ReplaceStatement Statement = "replace"
	UpdateStatement  Statement = "update"
	DeleteStatement  Statement = "delete"
	AlterStatement   Statement = "alter"
	CreateStatement  Statement = "create"
	DropStatement    Statement = "drop"
)

func StatementFrom

func StatementFrom(t string) Statement

func (Statement) String

func (s Statement) String() string

type TableExpr added in v0.8.0

type TableExpr struct {
	Expr struct {
		Ast Select `json:"ast"`
	} `json:"expr"`
	As *string `json:"as,omitempty"`
}

type Update

type Update struct {
	Type  Statement `json:"type"`
	DB    string    `json:"db"`
	Table []any     `json:"table"`
	// Set   []SetList `json:"set"`
	Where any `json:"where"`
}

type Use

type Use struct {
	Type Statement `json:"type"`
	DB   string    `json:"db"`
}

type With

type With struct {
	Name struct {
		Value string `json:"value"`
	} `json:"name"`
	Stmt struct {
		Parentheses *bool    `json:"_parentheses"`
		TableList   []string `json:"tableList"`
		ColumnList  []string `json:"columnList"`
		Ast         Select   `json:"ast"`
	} `json:"stmt"`
	Columns []string `json:"columns"`
}

Jump to

Keyboard shortcuts

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