schema

package
v0.1.3 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ValidateDependencyClosure

func ValidateDependencyClosure(
	graph DependencyGraph,
	selected map[string]struct{},
	includeRequired bool,
	includeOptional bool,
) error

ValidateDependencyClosure validates input and returns an error on failure.

Types

type Column

type Column struct {
	Name       string
	FieldName  string
	GoType     string
	Nullable   bool
	Unique     bool
	EnumValues []string
}

type DependencyEdge

type DependencyEdge struct {
	FromTable string
	ToTable   string
	FK        ForeignKey
}

type DependencyGraph

type DependencyGraph struct {
	TableByName map[string]Table
	Out         map[string][]DependencyEdge
	In          map[string][]DependencyEdge
}

func BuildDependencyGraph

func BuildDependencyGraph(tables []Table) (DependencyGraph, error)

BuildDependencyGraph builds and returns the resulting value.

type ForeignKey

type ForeignKey struct {
	Name          string
	Column        string
	RefTable      string
	RefColumn     string
	Required      bool
	ConstraintRaw string
}

type SelectionOptions

type SelectionOptions struct {
	RequestedTables []string
	IncludeRequired bool
	IncludeOptional bool
}

type SelectionResult

type SelectionResult struct {
	Tables        []Table
	Selected      map[string]struct{}
	AddedRequired []string
	AddedOptional []string
}

func ResolveSelection

func ResolveSelection(tables []Table, options SelectionOptions) (SelectionResult, error)

ResolveSelection resolves dependencies for the requested value.

type Table

type Table struct {
	Name        string
	StructName  string
	Columns     []Column
	ForeignKeys []ForeignKey
}

func ParseFile

func ParseFile(path string) ([]Table, error)

ParseFile parses input into structured data.

func ParseSQL

func ParseSQL(sqlText string) ([]Table, error)

ParseSQL parses input into structured data.

func (Table) ColumnByName

func (t Table) ColumnByName(name string) (Column, bool)

ColumnByName creates a column reference helper.

Jump to

Keyboard shortcuts

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