sqlite

package
v1.5.0 Latest Latest
Warning

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

Go to latest
Published: Feb 10, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RunCheck

func RunCheck(w io.Writer, dbPath string, opts Options) error

RunCheck verifies database integrity

func RunColumns

func RunColumns(w io.Writer, dbPath, table string, opts Options) error

RunColumns shows table columns

func RunDump

func RunDump(w io.Writer, dbPath, table string, opts Options) error

RunDump exports database as SQL

func RunImport

func RunImport(w io.Writer, dbPath, sqlFile string, opts Options) error

RunImport imports SQL file into database

func RunIndexes

func RunIndexes(w io.Writer, dbPath string, opts Options) error

RunIndexes lists all indexes

func RunQuery

func RunQuery(w io.Writer, dbPath, query string, opts Options) error

RunQuery executes a SQL query and displays results

func RunSchema

func RunSchema(w io.Writer, dbPath, table string, opts Options) error

RunSchema shows table schema

func RunStats

func RunStats(w io.Writer, dbPath string, opts Options) error

RunStats displays database statistics

func RunTables

func RunTables(w io.Writer, dbPath string, opts Options) error

RunTables lists all tables in the database

func RunVacuum

func RunVacuum(w io.Writer, dbPath string, opts Options) error

RunVacuum optimizes the database

Types

type ColumnInfo

type ColumnInfo struct {
	CID        int    `json:"cid"`
	Name       string `json:"name"`
	Type       string `json:"type"`
	NotNull    bool   `json:"notnull"`
	Default    any    `json:"default"`
	PrimaryKey bool   `json:"pk"`
}

ColumnInfo represents column information for JSON output

type IndexInfo

type IndexInfo struct {
	Name    string `json:"name"`
	Table   string `json:"table"`
	Unique  bool   `json:"unique"`
	Columns string `json:"columns"`
}

IndexInfo represents index information for JSON output

type Options

type Options struct {
	JSON      bool           // --json: output as JSON
	Header    bool           // --header: show column headers
	Separator string         // --separator: column separator
	Mode      string         // --mode: output mode (column, csv, line, etc)
	Logger    *logger.Logger // optional logger for query logging
	LogData   bool           // --log-data: include result data in logs (careful with large results)
}

Options configures sqlite command behavior

type StatsResult

type StatsResult struct {
	Path       string `json:"path"`
	Size       int64  `json:"size"`
	Tables     int    `json:"tables"`
	Indexes    int    `json:"indexes"`
	Views      int    `json:"views"`
	Triggers   int    `json:"triggers"`
	PageSize   int64  `json:"page_size"`
	PageCount  int64  `json:"page_count"`
	FreePages  int64  `json:"free_pages"`
	SchemaVer  int64  `json:"schema_version"`
	UserVer    int64  `json:"user_version"`
	WALEnabled bool   `json:"wal_enabled"`
}

StatsResult represents database statistics for JSON output

type TableInfo

type TableInfo struct {
	Name     string `json:"name"`
	Type     string `json:"type"`
	RowCount int64  `json:"row_count,omitempty"`
}

TableInfo represents table information for JSON output

Jump to

Keyboard shortcuts

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