schema

package
v0.1.7 Latest Latest
Warning

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

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

Documentation

Overview

Package schema provides types for representing SQLite database schemas

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Column

type Column struct {
	Name       string
	Type       string
	NotNull    bool
	Default    *string
	PrimaryKey int // 0 = not PK, 1+ = PK position
}

Column represents a table column (from PRAGMA table_info)

type Database

type Database struct {
	Tables   map[string]*Table
	Indexes  map[string]*Index
	Views    map[string]*View
	Triggers map[string]*Trigger
}

Database represents a complete SQLite database schema

func NewDatabase

func NewDatabase() *Database

NewDatabase creates a new empty database schema

type Index

type Index struct {
	Name  string
	Table string
	SQL   string
}

Index represents a SQLite index

type Table

type Table struct {
	Name    string
	Columns []Column
	SQL     string // Original CREATE TABLE statement
}

Table represents a SQLite table

func (*Table) ColumnNames

func (t *Table) ColumnNames() []string

ColumnNames returns the column names for a table

func (*Table) GetColumn

func (t *Table) GetColumn(name string) *Column

GetColumn returns a column by name, or nil if not found

func (*Table) HasColumn

func (t *Table) HasColumn(name string) bool

HasColumn checks if a table has a column by name

type Trigger

type Trigger struct {
	Name  string
	Table string
	SQL   string
}

Trigger represents a SQLite trigger

type View

type View struct {
	Name string
	SQL  string
}

View represents a SQLite view

Jump to

Keyboard shortcuts

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