sql

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Feb 9, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package sql generates SQL schema definitions from a database catalog. It supports multiple SQL dialects including SQLite, MySQL, and PostgreSQL.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Dialect

type Dialect string

Dialect represents the target SQL database dialect.

const (
	// DialectSQLite generates SQLite-compatible SQL.
	DialectSQLite Dialect = "sqlite"
	// DialectMySQL generates MySQL-compatible SQL.
	DialectMySQL Dialect = "mysql"
	// DialectPostgres generates PostgreSQL-compatible SQL.
	DialectPostgres Dialect = "postgres"
)

type File

type File struct {
	Path    string
	Content []byte
}

File represents a generated SQL file.

type Generator

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

Generator produces SQL schema files from a database catalog.

func New

func New(opts Options) *Generator

New creates a new SQL generator with the specified options.

func (*Generator) Generate

func (g *Generator) Generate(catalog *model.Catalog) ([]File, error)

Generate creates SQL schema files from the given catalog.

type Options

type Options struct {
	// Dialect specifies the target SQL dialect.
	Dialect Dialect
	// EmitIFNotExists controls whether IF NOT EXISTS clauses are generated.
	EmitIFNotExists bool
	// EmitComments controls whether comments are included in output.
	EmitComments bool
}

Options configures the SQL generator.

Jump to

Keyboard shortcuts

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