sql

package
v0.0.9 Latest Latest
Warning

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

Go to latest
Published: Jan 3, 2026 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Dialect

type Dialect interface {
	Name() string
	MapType(fieldType definition.FieldType, length int, precision int, scale int) string
	QuoteIdentifier(name string) string
	AutoIncrement() string
	BooleanType() string
	DefaultValue(value interface{}, fieldType definition.FieldType) string
}

Dialect represents a SQL dialect

type Generator

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

Generator generates SQL migration files

func NewGenerator

func NewGenerator(dialectName string) (*Generator, error)

NewGenerator creates a new SQL generator

func (*Generator) Description

func (g *Generator) Description() string

Description returns the generator description

func (*Generator) Generate

func (g *Generator) Generate(schema *definition.Schema, opts generator.Options) error

Generate generates SQL migration files

func (*Generator) Name

func (g *Generator) Name() string

Name returns the generator name

type MySQLDialect

type MySQLDialect struct{}

MySQLDialect implements MySQL dialect

func (*MySQLDialect) AutoIncrement

func (d *MySQLDialect) AutoIncrement() string

func (*MySQLDialect) BooleanType

func (d *MySQLDialect) BooleanType() string

func (*MySQLDialect) DefaultValue

func (d *MySQLDialect) DefaultValue(value interface{}, fieldType definition.FieldType) string

func (*MySQLDialect) MapType

func (d *MySQLDialect) MapType(fieldType definition.FieldType, length int, precision int, scale int) string

func (*MySQLDialect) Name

func (d *MySQLDialect) Name() string

func (*MySQLDialect) QuoteIdentifier

func (d *MySQLDialect) QuoteIdentifier(name string) string

type PostgreSQLDialect

type PostgreSQLDialect struct{}

PostgreSQLDialect implements PostgreSQL dialect

func (*PostgreSQLDialect) AutoIncrement

func (d *PostgreSQLDialect) AutoIncrement() string

func (*PostgreSQLDialect) BooleanType

func (d *PostgreSQLDialect) BooleanType() string

func (*PostgreSQLDialect) DefaultValue

func (d *PostgreSQLDialect) DefaultValue(value interface{}, fieldType definition.FieldType) string

func (*PostgreSQLDialect) MapType

func (d *PostgreSQLDialect) MapType(fieldType definition.FieldType, length int, precision int, scale int) string

func (*PostgreSQLDialect) Name

func (d *PostgreSQLDialect) Name() string

func (*PostgreSQLDialect) QuoteIdentifier

func (d *PostgreSQLDialect) QuoteIdentifier(name string) string

type SQLiteDialect

type SQLiteDialect struct{}

SQLiteDialect implements SQLite dialect

func (*SQLiteDialect) AutoIncrement

func (d *SQLiteDialect) AutoIncrement() string

func (*SQLiteDialect) BooleanType

func (d *SQLiteDialect) BooleanType() string

func (*SQLiteDialect) DefaultValue

func (d *SQLiteDialect) DefaultValue(value interface{}, fieldType definition.FieldType) string

func (*SQLiteDialect) MapType

func (d *SQLiteDialect) MapType(fieldType definition.FieldType, length int, precision int, scale int) string

func (*SQLiteDialect) Name

func (d *SQLiteDialect) Name() string

func (*SQLiteDialect) QuoteIdentifier

func (d *SQLiteDialect) QuoteIdentifier(name string) string

Jump to

Keyboard shortcuts

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