ir

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Apr 7, 2026 License: MIT Imports: 0 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AlterTableSpec

type AlterTableSpec struct {
	Kind           AlterTableSpecKind
	Column         CreateTableColumn
	Name           string
	NewName        string
	Default        string
	ConstraintName string
	Parts          []IndexPart
	IfExists       bool
	IfNotExists    bool
	Reference      ForeignKeyReference
}

AlterTableSpec is a normalized ALTER TABLE operation.

type AlterTableSpecKind

type AlterTableSpecKind string

AlterTableSpecKind identifies the normalized ALTER TABLE operation kind.

const (
	AlterTableSpecAddColumn      AlterTableSpecKind = "add_column"
	AlterTableSpecDropColumn     AlterTableSpecKind = "drop_column"
	AlterTableSpecSetDefault     AlterTableSpecKind = "set_default"
	AlterTableSpecDropDefault    AlterTableSpecKind = "drop_default"
	AlterTableSpecAlterType      AlterTableSpecKind = "alter_type"
	AlterTableSpecSetNotNull     AlterTableSpecKind = "set_not_null"
	AlterTableSpecDropNotNull    AlterTableSpecKind = "drop_not_null"
	AlterTableSpecRenameColumn   AlterTableSpecKind = "rename_column"
	AlterTableSpecAddPrimaryKey  AlterTableSpecKind = "add_primary_key"
	AlterTableSpecAddUniqueKey   AlterTableSpecKind = "add_unique_key"
	AlterTableSpecAddForeignKey  AlterTableSpecKind = "add_foreign_key"
	AlterTableSpecDropPrimaryKey AlterTableSpecKind = "drop_primary_key"
	AlterTableSpecDropForeignKey AlterTableSpecKind = "drop_foreign_key"
)

type AlterTableStatement

type AlterTableStatement struct {
	Name  string
	Specs []AlterTableSpec
}

AlterTableStatement is the normalized ALTER TABLE IR.

type Assignment

type Assignment struct {
	Column string
	Value  string
}

Assignment is the normalized assignment node.

type BatchStatement

type BatchStatement struct {
	Statements []Statement
}

BatchStatement preserves a sequence of statements that must be rendered in order.

type ConflictClause

type ConflictClause struct {
	Style         ConflictStyle
	TargetColumns []string
	Assignments   []Assignment
}

ConflictClause is the normalized upsert node.

type ConflictStyle

type ConflictStyle string

ConflictStyle identifies the source upsert form.

const (
	// ConflictStyleMySQL represents mysql upsert semantics.
	ConflictStyleMySQL ConflictStyle = "mysql"
	// ConflictStylePostgres represents postgres upsert semantics.
	ConflictStylePostgres ConflictStyle = "postgres"
)

type CreateIndexStatement

type CreateIndexStatement struct {
	Name        string
	Table       string
	Unique      bool
	IfNotExists bool
	Parts       []IndexPart
	Using       string
	ParserName  string
	Where       string
	Comment     string
	Visibility  string
	Algorithm   string
	Lock        string
}

CreateIndexStatement is the normalized CREATE INDEX IR.

type CreateTableColumn

type CreateTableColumn struct {
	Name          string
	Type          string
	NotNull       bool
	PrimaryKey    bool
	Unique        bool
	AutoIncrement bool
	Default       string
}

CreateTableColumn is a normalized CREATE TABLE column definition.

type CreateTableStatement

type CreateTableStatement struct {
	Name        string
	IfNotExists bool
	Columns     []CreateTableColumn
	Constraints []string
}

CreateTableStatement is the normalized CREATE TABLE IR.

type DeleteStatement

type DeleteStatement struct {
	Table string
	Where string
}

DeleteStatement is the normalized DELETE IR.

type DropIndexStatement

type DropIndexStatement struct {
	Name     string
	IfExists bool
	Table    string
}

DropIndexStatement is the normalized DROP INDEX IR.

type ForeignKeyReference

type ForeignKeyReference struct {
	Table    string
	Parts    []IndexPart
	Match    string
	OnDelete string
	OnUpdate string
}

ForeignKeyReference is a normalized foreign-key reference definition.

type IndexPart

type IndexPart struct {
	Column string
	Expr   string
	Length int
	Desc   bool
}

IndexPart is a normalized index key part.

type InsertStatement

type InsertStatement struct {
	Table    string
	Columns  []string
	Values   []string
	Conflict *ConflictClause
}

InsertStatement is the normalized INSERT IR.

type Join

type Join struct {
	Kind  string
	Table string
	On    string
}

Join is a normalized join node.

type LimitClause

type LimitClause struct {
	Offset *int
	Count  int
}

LimitClause is the normalized limit node.

type RawStatement

type RawStatement struct {
	SQL string
}

RawStatement preserves raw SQL for pass-through rendering.

type ReleaseSavepointStatement

type ReleaseSavepointStatement struct {
	Name string
}

ReleaseSavepointStatement is the normalized RELEASE SAVEPOINT statement.

type RenameTableStatement

type RenameTableStatement struct {
	OldName string
	NewName string
}

RenameTableStatement is the normalized RENAME TABLE IR.

type RollbackToSavepointStatement

type RollbackToSavepointStatement struct {
	Name string
}

RollbackToSavepointStatement is the normalized ROLLBACK TO SAVEPOINT statement.

type SavepointStatement

type SavepointStatement struct {
	Name string
}

SavepointStatement is the normalized SAVEPOINT statement.

type SelectStatement

type SelectStatement struct {
	Columns []string
	From    string
	Joins   []Join
	Where   string
	OrderBy []string
	Limit   *LimitClause
}

SelectStatement is the normalized SELECT IR.

type SetStatement

type SetStatement struct {
	Kind    string
	Charset string
}

SetStatement is the normalized safe subset of SET statements.

type SetTransactionStatement

type SetTransactionStatement struct {
	Scope          string
	IsolationLevel string
	AccessMode     string
}

SetTransactionStatement is the normalized transaction isolation SET statement.

type ShowColumnsStatement

type ShowColumnsStatement struct {
	Table    string
	Database string
	Full     bool
	Pattern  string
	Field    string
}

ShowColumnsStatement is the normalized SHOW COLUMNS statement.

type ShowCreateDatabaseStatement

type ShowCreateDatabaseStatement struct {
	Name        string
	IfNotExists bool
}

ShowCreateDatabaseStatement is the normalized SHOW CREATE DATABASE statement.

type ShowCreateTableStatement

type ShowCreateTableStatement struct {
	Schema string
	Name   string
}

ShowCreateTableStatement is the normalized SHOW CREATE TABLE statement.

type ShowCreateViewStatement

type ShowCreateViewStatement struct {
	Schema string
	Name   string
}

ShowCreateViewStatement is the normalized SHOW CREATE VIEW statement.

type ShowDatabasesStatement

type ShowDatabasesStatement struct {
	Pattern string
	Name    string
}

ShowDatabasesStatement is the normalized SHOW DATABASES statement.

type ShowIndexStatement

type ShowIndexStatement struct {
	Table      string
	Database   string
	KeyName    string
	Column     string
	IndexType  string
	NonUnique  string
	SeqInIndex string
}

ShowIndexStatement is the normalized SHOW INDEX statement.

type ShowTableStatusStatement

type ShowTableStatusStatement struct {
	Database string
	Pattern  string
	Name     string
	Comment  string
	Engine   string
}

ShowTableStatusStatement is the normalized SHOW TABLE STATUS statement.

type ShowTablesStatement

type ShowTablesStatement struct {
	Database  string
	Full      bool
	Pattern   string
	Name      string
	TableType string
}

ShowTablesStatement is the normalized SHOW TABLES statement.

type ShowVariablesStatement

type ShowVariablesStatement struct {
	Pattern string
	Name    string
}

ShowVariablesStatement is the normalized SHOW VARIABLES statement.

type Statement

type Statement interface {
	// contains filtered or unexported methods
}

Statement is the normalized IR statement.

type UpdateStatement

type UpdateStatement struct {
	Table       string
	Assignments []Assignment
	Where       string
}

UpdateStatement is the normalized UPDATE IR.

type UseStatement

type UseStatement struct {
	Database string
}

UseStatement is the normalized USE/current-schema statement.

Jump to

Keyboard shortcuts

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