database

package
v0.17.16 Latest Latest
Warning

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

Go to latest
Published: Aug 1, 2024 License: Apache-2.0, MIT Imports: 10 Imported by: 1

Documentation

Overview

This package has database database layer. Never deal with DDL construction.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RunDDLs

func RunDDLs(d Database, ddls []string, enableDropTable bool, beforeApply string, ddlSuffix string) error

func TransactionSupported

func TransactionSupported(ddl string) bool

Types

type Config

type Config struct {
	DbName        string
	User          string
	Password      string
	Host          string
	Port          int
	Socket        string
	SkipView      bool
	SkipExtension bool

	// Only MySQL
	MySQLEnableCleartextPlugin bool
	SslMode                    string
	SslCa                      string

	// Only PostgreSQL
	TargetSchema []string
}

type DDLStatement

type DDLStatement struct {
	DDL       string
	Statement parser.Statement
}

A tuple of an original DDL and a Statement

type Database

type Database interface {
	DumpDDLs() (string, error)
	DB() *sql.DB
	Close() error
	GetDefaultSchema() string
}

Abstraction layer for multiple kinds of databases

type GeneratorConfig

type GeneratorConfig struct {
	TargetTables []string
	SkipTables   []string
	TargetSchema []string
	Algorithm    string
	Lock         string
}

func ParseGeneratorConfig

func ParseGeneratorConfig(configFile string) GeneratorConfig

type GenericParser

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

func NewParser

func NewParser(mode parser.ParserMode) GenericParser

func (GenericParser) Parse

func (p GenericParser) Parse(sql string) ([]DDLStatement, error)

type Parser

type Parser interface {
	Parse(sql string) ([]DDLStatement, error)
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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