schema

package
v0.1.14 Latest Latest
Warning

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

Go to latest
Published: May 22, 2025 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ColumnInfo

type ColumnInfo struct {
	Name       string  // Column name
	DataType   string  // Database type (e.g., INT, VARCHAR(255))
	IsNullable bool    // Whether the column is nullable
	IsPrimary  bool    // Whether this column is the primary key
	IsUnique   bool    // Whether this column has a unique constraint
	Default    *string // Default value (if any)
}

ColumnInfo holds metadata for a single column in a table.

type IndexInfo

type IndexInfo struct {
	Name    string   // Index name
	Columns []string // Column names
	Unique  bool     // Is unique index
}

IndexInfo holds metadata for a single index (normal or unique).

type Introspector

type Introspector interface {
	// GetTableInfo introspects the given table and returns its schema info.
	GetTableInfo(ctx context.Context, tableName string) (*TableInfo, error)
}

Introspector defines the interface for database schema introspection.

type TableInfo

type TableInfo struct {
	Name       string       // Table name
	Columns    []ColumnInfo // All columns
	Indexes    []IndexInfo  // All indexes (including unique)
	PrimaryKey string       // Primary key column name (if any)
}

TableInfo holds the actual schema info introspected from the database.

Jump to

Keyboard shortcuts

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