sources

package
v0.1.21 Latest Latest
Warning

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

Go to latest
Published: Jul 29, 2025 License: MIT Imports: 13 Imported by: 2

Documentation

Index

Constants

View Source
const (
	FileSourceType    types.CatalogSourceType = "localFS"
	URISourceType     types.CatalogSourceType = "uri"
	URIFileSourceType types.CatalogSourceType = "uriFile"
)

Variables

View Source
var ErrNoSourcesByURI = errors.New("no sources found by URI")

Functions

This section is empty.

Types

type CatalogSourceLoader

type CatalogSourceLoader interface {
	Reload(ctx context.Context) error
}

type DBColumnInfo added in v0.1.14

type DBColumnInfo struct {
	Name        string `json:"name"`
	Description string `json:"description"`
	DataType    string `json:"data_type"`
	IsNullable  bool   `json:"is_nullable"`
	Default     string `json:"default,omitempty"`
}

func (*DBColumnInfo) Definition added in v0.1.14

func (c *DBColumnInfo) Definition() (*ast.FieldDefinition, error)

type DBConstraintInfo added in v0.1.14

type DBConstraintInfo struct {
	Name              string   `json:"name"`
	Type              string   `json:"type"`                             // e.g., PRIMARY KEY, FOREIGN KEY, UNIQUE
	Columns           []string `json:"columns"`                          // list of column names involved in the constraint
	ReferencesSchema  string   `json:"references_schema_name,omitempty"` // for foreign keys, the schema of the referenced table
	ReferencesTable   string   `json:"references_table_name,omitempty"`  // for foreign keys
	ReferencesColumns []string `json:"references_columns,omitempty"`     // columns in the referenced table
}

type DBInfo added in v0.1.14

type DBInfo struct {
	Name        string         `json:"name"`
	Description string         `json:"description"`
	Type        string         `json:"type"` // e.g., "mysql", "postgres", "duckdb", "memory", etc.
	SchemaInfo  []DBSchemaInfo `json:"schemas"`
}

create catalog source by provided database definition

func DescribeDataSource added in v0.1.14

func DescribeDataSource(ctx context.Context, qe types.Querier, name string) (*DBInfo, error)

func (*DBInfo) SchemaDocument added in v0.1.14

func (s *DBInfo) SchemaDocument(ctx context.Context) (*ast.SchemaDocument, error)

type DBSchemaInfo added in v0.1.14

type DBSchemaInfo struct {
	Name        string        `json:"name"`
	Description string        `json:"description"`
	Tables      []DBTableInfo `json:"tables"`
	Views       []DBViewInfo  `json:"views"`
}

func (*DBSchemaInfo) Definitions added in v0.1.14

func (s *DBSchemaInfo) Definitions() (ast.DefinitionList, error)

type DBTableInfo added in v0.1.14

type DBTableInfo struct {
	Name        string             `json:"name"`
	Description string             `json:"description"`
	SchemaName  string             `json:"schema_name"`
	Columns     []DBColumnInfo     `json:"columns"`
	Constraints []DBConstraintInfo `json:"constraints"`
}

func (*DBTableInfo) Definition added in v0.1.14

func (t *DBTableInfo) Definition() (*ast.Definition, error)

type DBViewInfo added in v0.1.14

type DBViewInfo struct {
	Name        string         `json:"name"`
	SchemaName  string         `json:"schema_name"`
	Description string         `json:"description"`
	Columns     []DBColumnInfo `json:"columns"`
}

func (*DBViewInfo) Definition added in v0.1.14

func (v *DBViewInfo) Definition() (*ast.Definition, error)

type FileSource

type FileSource struct {
	// contains filtered or unexported fields
}

func NewFileSource

func NewFileSource(path string) *FileSource

func (*FileSource) Reload

func (s *FileSource) Reload(_ context.Context) error

func (*FileSource) SchemaDocument

func (s *FileSource) SchemaDocument(ctx context.Context) (*ast.SchemaDocument, error)

type MergedSource

type MergedSource struct {
	// contains filtered or unexported fields
}

func MergeSource

func MergeSource(sources ...Source) *MergedSource

func (*MergedSource) Reload

func (s *MergedSource) Reload(ctx context.Context) error

func (*MergedSource) SchemaDocument

func (s *MergedSource) SchemaDocument(ctx context.Context) (*ast.SchemaDocument, error)

type Source

type Source interface {
	SchemaDocument(ctx context.Context) (*ast.SchemaDocument, error)
}

type StringSource

type StringSource struct {
	// contains filtered or unexported fields
}

func NewStringSource

func NewStringSource(name string, sources ...string) StringSource

func (StringSource) SchemaDocument

func (s StringSource) SchemaDocument(_ context.Context) (*ast.SchemaDocument, error)

type URISource

type URISource struct {
	// contains filtered or unexported fields
}

func NewURISource

func NewURISource(db *db.Pool, path string, isFile bool) *URISource

func (*URISource) Reload

func (s *URISource) Reload(ctx context.Context) error

func (URISource) SchemaDocument

func (s URISource) SchemaDocument(ctx context.Context) (*ast.SchemaDocument, error)

Jump to

Keyboard shortcuts

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