types

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Apr 18, 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 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 Insert

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

type InsertValue

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

type Option

type Option struct {
	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) 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
}

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     []With    `json:"with"`
	Options  []any     `json:"options"`
	Distinct string    `json:"distinct"`
	Columns  []any     `json:"columns"`
	// From               []From     `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 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 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