schema

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Apr 3, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetDefaultCachePath

func GetDefaultCachePath(baseDir string) string

GetDefaultCachePath returns the default path for schema cache

Types

type ColumnInfo

type ColumnInfo struct {
	Name      string `json:"name"`
	Type      string `json:"type"`
	Nullable  bool   `json:"nullable"`
	IsPrimary bool   `json:"is_primary"`
	Default   string `json:"default,omitempty"`
}

ColumnInfo represents column metadata

type Discoverer

type Discoverer interface {
	DiscoverTables() ([]string, error)
	GetTableColumns(table string) ([]ColumnInfo, error)
	SaveCache(cacheFile string) error
	LoadCache(cacheFile string) error
}

Discoverer defines the interface for schema discovery

func CreateDiscoverer

func CreateDiscoverer(mode string, staticTables []string, dbType string, dbConfig map[string]string) (Discoverer, error)

CreateDiscoverer creates a discoverer based on mode and configuration

type NoOpDiscoverer

type NoOpDiscoverer struct{}

NoOpDiscoverer implements Discoverer for when discovery is disabled

func NewNoOpDiscoverer

func NewNoOpDiscoverer() *NoOpDiscoverer

func (*NoOpDiscoverer) DiscoverTables

func (n *NoOpDiscoverer) DiscoverTables() ([]string, error)

func (*NoOpDiscoverer) GetTableColumns

func (n *NoOpDiscoverer) GetTableColumns(table string) ([]ColumnInfo, error)

func (*NoOpDiscoverer) LoadCache

func (n *NoOpDiscoverer) LoadCache(cacheFile string) error

func (*NoOpDiscoverer) SaveCache

func (n *NoOpDiscoverer) SaveCache(cacheFile string) error

type SchemaCache

type SchemaCache struct {
	Tables  map[string][]ColumnInfo `json:"tables"`
	Version string                  `json:"version"`
}

SchemaCache represents cached schema information

type StaticDiscoverer

type StaticDiscoverer struct {
	Tables     []string
	ColumnInfo map[string][]ColumnInfo
}

StaticDiscoverer implements Discoverer for static table lists

func NewStaticDiscoverer

func NewStaticDiscoverer(tables []string) *StaticDiscoverer

func (*StaticDiscoverer) DiscoverTables

func (s *StaticDiscoverer) DiscoverTables() ([]string, error)

func (*StaticDiscoverer) GetTableColumns

func (s *StaticDiscoverer) GetTableColumns(table string) ([]ColumnInfo, error)

func (*StaticDiscoverer) LoadCache

func (s *StaticDiscoverer) LoadCache(cacheFile string) error

func (*StaticDiscoverer) SaveCache

func (s *StaticDiscoverer) SaveCache(cacheFile string) error

func (*StaticDiscoverer) SetTableColumns

func (s *StaticDiscoverer) SetTableColumns(table string, columns []ColumnInfo)

Jump to

Keyboard shortcuts

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