catalog

package
v0.0.8 Latest Latest
Warning

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

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

Documentation

Overview

Package catalog provides catalog management for XxSql storage engine.

Index

Constants

View Source
const (
	// CatalogFileName is the name of the catalog file.
	CatalogFileName = "catalog.json"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Catalog

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

Catalog manages all table metadata.

func NewCatalog

func NewCatalog(dataDir string) *Catalog

NewCatalog creates a new catalog.

func (*Catalog) Close

func (c *Catalog) Close() error

Close closes the catalog and all tables.

func (*Catalog) CreateFTSIndex added in v0.0.5

func (c *Catalog) CreateFTSIndex(name, tableName string, columns []string, tokenizer string) error

CreateFTSIndex creates a new FTS index.

func (*Catalog) CreateTable

func (c *Catalog) CreateTable(name string, columns []*types.ColumnInfo) error

CreateTable creates a new table.

func (*Catalog) CreateTrigger added in v0.0.5

func (c *Catalog) CreateTrigger(name string, timing, event int, tableName string, granularity int, whenClause, body string) error

CreateTrigger creates a new trigger.

func (*Catalog) CreateView added in v0.0.5

func (c *Catalog) CreateView(name string, query string, columns []string, checkOption string) error

CreateView creates a new view.

func (*Catalog) DropFTSIndex added in v0.0.5

func (c *Catalog) DropFTSIndex(name string) error

DropFTSIndex drops an FTS index.

func (*Catalog) DropTable

func (c *Catalog) DropTable(name string) error

DropTable drops a table.

func (*Catalog) DropTrigger added in v0.0.5

func (c *Catalog) DropTrigger(name string) error

DropTrigger drops a trigger.

func (*Catalog) DropView added in v0.0.5

func (c *Catalog) DropView(name string) error

DropView drops a view.

func (*Catalog) FTSIndexExists added in v0.0.5

func (c *Catalog) FTSIndexExists(name string) bool

FTSIndexExists checks if an FTS index exists.

func (*Catalog) Flush

func (c *Catalog) Flush() error

Flush flushes all tables to disk.

func (*Catalog) GetFTSIndex added in v0.0.5

func (c *Catalog) GetFTSIndex(name string) (*FTSInfo, error)

GetFTSIndex returns an FTS index by name.

func (*Catalog) GetFTSIndexesForTable added in v0.0.5

func (c *Catalog) GetFTSIndexesForTable(tableName string) []*FTSInfo

GetFTSIndexesForTable returns all FTS indexes for a table.

func (*Catalog) GetTable

func (c *Catalog) GetTable(name string) (*table.Table, error)

GetTable returns a table by name.

func (*Catalog) GetTableInfos

func (c *Catalog) GetTableInfos() []*table.TableInfo

GetTableInfos returns information about all tables.

func (*Catalog) GetTrigger added in v0.0.5

func (c *Catalog) GetTrigger(name string) (*TriggerInfo, error)

GetTrigger returns a trigger by name.

func (*Catalog) GetTriggersForTable added in v0.0.5

func (c *Catalog) GetTriggersForTable(tableName string, event int) []*TriggerInfo

GetTriggersForTable returns all triggers for a specific table and event.

func (*Catalog) GetView added in v0.0.5

func (c *Catalog) GetView(name string) (*ViewInfo, error)

GetView returns a view by name.

func (*Catalog) ListFTSIndexes added in v0.0.5

func (c *Catalog) ListFTSIndexes() []string

ListFTSIndexes returns all FTS index names.

func (*Catalog) ListTables

func (c *Catalog) ListTables() []string

ListTables returns all table names.

func (*Catalog) ListTriggers added in v0.0.5

func (c *Catalog) ListTriggers() []string

ListTriggers returns all trigger names.

func (*Catalog) ListViews added in v0.0.5

func (c *Catalog) ListViews() []string

ListViews returns all view names.

func (*Catalog) Open

func (c *Catalog) Open() error

Open opens the catalog and loads all tables.

func (*Catalog) RenameTable

func (c *Catalog) RenameTable(oldName, newName string) error

RenameTable renames a table.

func (*Catalog) TableCount

func (c *Catalog) TableCount() int

TableCount returns the number of tables.

func (*Catalog) TableExists

func (c *Catalog) TableExists(name string) bool

TableExists checks if a table exists.

func (*Catalog) TriggerExists added in v0.0.5

func (c *Catalog) TriggerExists(name string) bool

TriggerExists checks if a trigger exists.

func (*Catalog) ViewExists added in v0.0.5

func (c *Catalog) ViewExists(name string) bool

ViewExists checks if a view exists.

type FTSInfo added in v0.0.5

type FTSInfo struct {
	Name      string   // Index name
	TableName string   // Table name
	Columns   []string // Indexed columns
	Tokenizer string   // Tokenizer type
}

FTSInfo stores FTS index definition.

type TriggerInfo added in v0.0.5

type TriggerInfo struct {
	Name        string
	Timing      int // 0=BEFORE, 1=AFTER, 2=INSTEAD OF
	Event       int // 0=INSERT, 1=UPDATE, 2=DELETE
	TableName   string
	Granularity int // 0=FOR EACH ROW, 1=FOR EACH STATEMENT
	WhenClause  string
	Body        string
}

TriggerInfo stores trigger definition.

type ViewInfo added in v0.0.5

type ViewInfo struct {
	Name        string
	Query       string // The SQL query string
	Columns     []string
	CheckOption string // "CASCADED", "LOCAL", or "" (empty for no check)
}

ViewInfo stores view definition.

Jump to

Keyboard shortcuts

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