ddlconv

package
v1.3.1 Latest Latest
Warning

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

Go to latest
Published: Oct 14, 2021 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExtractAlterTableAddColComment

func ExtractAlterTableAddColComment(stmt *ast.AlterTableSpec) string

func ExtractAlterTableAddColName

func ExtractAlterTableAddColName(stmt *ast.AlterTableSpec) string

func ExtractAlterTableAddColType

func ExtractAlterTableAddColType(stmt *ast.AlterTableSpec) string

func ExtractAlterTableChangeColComment

func ExtractAlterTableChangeColComment(spec *ast.AlterTableSpec) string

func ExtractAlterTableChangeColNewName

func ExtractAlterTableChangeColNewName(stmt *ast.AlterTableSpec) string

func ExtractAlterTableChangeColOldName

func ExtractAlterTableChangeColOldName(stmt *ast.AlterTableSpec) string

func ExtractAlterTableChangeColType

func ExtractAlterTableChangeColType(spec *ast.AlterTableSpec) string

func ExtractAlterTableDropColName

func ExtractAlterTableDropColName(stmt *ast.AlterTableSpec) string

func ExtractAlterTableModifyColComment

func ExtractAlterTableModifyColComment(stmt *ast.AlterTableSpec) string

func ExtractAlterTableModifyColName

func ExtractAlterTableModifyColName(stmt *ast.AlterTableSpec) string

func ExtractAlterTableModifyColType

func ExtractAlterTableModifyColType(stmt *ast.AlterTableSpec) string

func ExtractAlterTableName

func ExtractAlterTableName(stmt *ast.AlterTableStmt) string

func ExtractColComment

func ExtractColComment(col *ast.ColumnDef) string

func ExtractColName

func ExtractColName(col *ast.ColumnDef) string

func ExtractColType

func ExtractColType(col *ast.ColumnDef) string

func ExtractCreateName

func ExtractCreateName(stmt *ast.CreateTableStmt) string

func ExtractDropNames

func ExtractDropNames(stmt *ast.DropTableStmt) []string

func ExtractRename

func ExtractRename(stmt *ast.RenameTableStmt) (newName, oldName string)

Types

type Components

type Components struct {
	Schemas map[string]OpenapiSchema `json:"schemas" yaml:"schemas"`
}

type DDLConverter

type DDLConverter struct {
	Openapi    string            `json:"openapi" yaml:"openapi"`
	Info       map[string]string `json:"info" yaml:"info"`
	Paths      struct{}          `json:"paths" yaml:"paths"`
	Components Components        `json:"components" yaml:"components"`
}

func New

func New(sql ...string) (*DDLConverter, error)

func (*DDLConverter) Enter

func (o *DDLConverter) Enter(in ast.Node) (ast.Node, bool)

func (*DDLConverter) JSON

func (o *DDLConverter) JSON() []byte

func (*DDLConverter) Leave

func (o *DDLConverter) Leave(in ast.Node) (ast.Node, bool)

func (*DDLConverter) Write

func (o *DDLConverter) Write(sql []byte) (int, error)

func (*DDLConverter) WriteString

func (o *DDLConverter) WriteString(sql string) (int, error)

func (*DDLConverter) YAML

func (o *DDLConverter) YAML() []byte

type OpenapiSchema

type OpenapiSchema struct {
	Name       string                            `json:"-" yaml:"-"`
	Type       string                            `json:"type" yaml:"type"`
	Properties map[string]*openapiSchemaProperty `json:"properties" yaml:"properties"`
}

Jump to

Keyboard shortcuts

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