schema

package
v0.26.0 Latest Latest
Warning

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

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

Documentation

Overview

Package schema owns non-destructive table provisioning through SQLX metadata.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Service

type Service struct {
	DB      *sql.DB
	Dialect *info.Dialect
}

Service provisions on the caller's native database. It does not own its lifetime, cache schema results, or begin a transaction (DDL may auto-commit).

func (*Service) EnsureTable

func (s *Service) EnsureTable(ctx context.Context, table Table) error

EnsureTable preserves an accessible existing table. Failed probes are followed by CREATE IF NOT EXISTS and another probe, never ALTER or DROP. A concurrent creator may win even when the vendor reports a catalog conflict on CREATE.

type Table

type Table struct {
	Name    string
	Dataset string
	Columns []io.Column
}

Table describes mapped columns and a parsed table destination. No raw DDL, default expressions, automatic IDs, migrations or destructive operations.

func (Table) CreateSQL

func (t Table) CreateSQL(dialect *info.Dialect) (string, error)

CreateSQL renders a create-if-absent statement using the native dialect.

Jump to

Keyboard shortcuts

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