Documentation
¶
Index ¶
- Constants
- func GetSampleDatabase() (*gorm.DB, error)
- func GetSampleProfile() types.DatabaseCredentials
- func IsSampleDatabase(name string) bool
- func NewSqlite3Plugin() *engine.Plugin
- type DateTimeString
- type SQLiteSQLBuilder
- type Sqlite3Plugin
- func (p *Sqlite3Plugin) ConvertRawToRows(rows *sql.Rows) (*engine.GetRowsResult, error)
- func (p *Sqlite3Plugin) ConvertStringValue(value, columnType string, isNullable bool) (any, error)
- func (p *Sqlite3Plugin) CreateSQLBuilder(db *gorm.DB) gorm_plugin.SQLBuilderInterface
- func (p *Sqlite3Plugin) DB(config *engine.PluginConfig) (*gorm.DB, error)
- func (p *Sqlite3Plugin) FormTableName(schema string, storageUnit string) string
- func (p *Sqlite3Plugin) GetAllSchemas(config *engine.PluginConfig) ([]string, error)
- func (p *Sqlite3Plugin) GetAllSchemasQuery() string
- func (p *Sqlite3Plugin) GetColumnConstraints(config *engine.PluginConfig, schema string, storageUnit string) (map[string]map[string]any, error)
- func (p *Sqlite3Plugin) GetColumnTypes(db *gorm.DB, schema, tableName string) (map[string]gorm_plugin.ColumnTypeInfo, error)
- func (p *Sqlite3Plugin) GetColumnsForTable(config *engine.PluginConfig, schema, storageUnit string) ([]engine.Column, error)
- func (p *Sqlite3Plugin) GetCreateTableQuery(db *gorm.DB, schema string, storageUnit string, columns []engine.Record) string
- func (p *Sqlite3Plugin) GetDatabases(config *engine.PluginConfig) ([]string, error)
- func (p *Sqlite3Plugin) GetForeignKeyRelationships(config *engine.PluginConfig, schema string, storageUnit string) (map[string]*engine.ForeignKeyRelationship, error)
- func (p *Sqlite3Plugin) GetGraphQueryDB(db *gorm.DB, schema string) *gorm.DB
- func (p *Sqlite3Plugin) GetLastInsertID(db *gorm.DB) (int64, error)
- func (p *Sqlite3Plugin) GetMaxBulkInsertParameters() int
- func (p *Sqlite3Plugin) GetOrderedColumnsWithTypes(db *gorm.DB, schema, tableName string) ([]engine.Column, map[string]gorm_plugin.ColumnTypeInfo, error)
- func (p *Sqlite3Plugin) GetPlaceholder(index int) string
- func (p *Sqlite3Plugin) GetPrimaryKeyColQuery() string
- func (p *Sqlite3Plugin) GetPrimaryKeyColumns(db *gorm.DB, schema string, tableName string) ([]string, error)
- func (p *Sqlite3Plugin) GetRows(config *engine.PluginConfig, req *engine.GetRowsRequest) (*engine.GetRowsResult, error)
- func (p *Sqlite3Plugin) GetSSLStatus(config *engine.PluginConfig) (*engine.SSLStatus, error)
- func (p *Sqlite3Plugin) GetStorageUnitExistsQuery() string
- func (p *Sqlite3Plugin) GetSupportedOperators() map[string]string
- func (p *Sqlite3Plugin) GetTableInfoQuery() string
- func (p *Sqlite3Plugin) GetTableNameAndAttributes(rows *sql.Rows) (string, []engine.Record)
- func (p *Sqlite3Plugin) IsTableStrict(db *gorm.DB, tableName string) bool
- func (p *Sqlite3Plugin) MarkGeneratedColumns(config *engine.PluginConfig, schema string, storageUnit string, ...) error
- func (p *Sqlite3Plugin) NormalizeType(typeName string) string
- func (p *Sqlite3Plugin) RawExecute(config *engine.PluginConfig, query string, params ...any) (*engine.GetRowsResult, error)
- func (p *Sqlite3Plugin) StreamRawExecute(config *engine.PluginConfig, query string, writer engine.QueryStreamWriter, ...) error
Constants ¶
const SampleDatabaseName = "whodb-sample"
Variables ¶
This section is empty.
Functions ¶
func GetSampleDatabase ¶
func GetSampleProfile ¶
func GetSampleProfile() types.DatabaseCredentials
func IsSampleDatabase ¶
func NewSqlite3Plugin ¶
Types ¶
type DateTimeString ¶
type DateTimeString string
DateTimeString is a custom type that stores datetime values as plain strings without any parsing or formatting. This is needed because SQLite stores datetime values as TEXT and we want to preserve the exact format.
func (*DateTimeString) Scan ¶
func (ds *DateTimeString) Scan(value any) error
Scan implements sql.Scanner interface to read datetime values as strings
type SQLiteSQLBuilder ¶
type SQLiteSQLBuilder struct {
*gorm_plugin.SQLBuilder
}
SQLiteSQLBuilder embeds the generic SQLBuilder and overrides methods for SQLite-specific syntax.
func NewSQLiteSQLBuilder ¶
func NewSQLiteSQLBuilder(db *gorm.DB, plugin gorm_plugin.GormPluginFunctions) *SQLiteSQLBuilder
NewSQLiteSQLBuilder creates a new SQL builder for SQLite.
func (*SQLiteSQLBuilder) PragmaQuery ¶
func (sb *SQLiteSQLBuilder) PragmaQuery(pragma, table string) (string, error)
PragmaQuery builds a SQLite PRAGMA query.
type Sqlite3Plugin ¶
type Sqlite3Plugin struct {
gorm_plugin.GormPlugin
// contains filtered or unexported fields
}
func (*Sqlite3Plugin) ConvertRawToRows ¶
func (p *Sqlite3Plugin) ConvertRawToRows(rows *sql.Rows) (*engine.GetRowsResult, error)
ConvertRawToRows overrides the parent to handle SQLite datetime columns specially This maintains backward compatibility for non-STRICT tables
func (*Sqlite3Plugin) ConvertStringValue ¶
func (p *Sqlite3Plugin) ConvertStringValue(value, columnType string, isNullable bool) (any, error)
ConvertStringValue overrides the base GORM implementation to preserve datetime strings
func (*Sqlite3Plugin) CreateSQLBuilder ¶
func (p *Sqlite3Plugin) CreateSQLBuilder(db *gorm.DB) gorm_plugin.SQLBuilderInterface
CreateSQLBuilder creates a SQLite-specific SQL builder.
func (*Sqlite3Plugin) DB ¶
func (p *Sqlite3Plugin) DB(config *engine.PluginConfig) (*gorm.DB, error)
func (*Sqlite3Plugin) FormTableName ¶
func (p *Sqlite3Plugin) FormTableName(schema string, storageUnit string) string
func (*Sqlite3Plugin) GetAllSchemas ¶
func (p *Sqlite3Plugin) GetAllSchemas(config *engine.PluginConfig) ([]string, error)
func (*Sqlite3Plugin) GetAllSchemasQuery ¶
func (p *Sqlite3Plugin) GetAllSchemasQuery() string
func (*Sqlite3Plugin) GetColumnConstraints ¶
func (p *Sqlite3Plugin) GetColumnConstraints(config *engine.PluginConfig, schema string, storageUnit string) (map[string]map[string]any, error)
GetColumnConstraints retrieves column constraints for SQLite tables
func (*Sqlite3Plugin) GetColumnTypes ¶
func (p *Sqlite3Plugin) GetColumnTypes(db *gorm.DB, schema, tableName string) (map[string]gorm_plugin.ColumnTypeInfo, error)
GetColumnTypes uses PRAGMA table_info directly instead of GORM's DDL parser.
func (*Sqlite3Plugin) GetColumnsForTable ¶
func (p *Sqlite3Plugin) GetColumnsForTable(config *engine.PluginConfig, schema, storageUnit string) ([]engine.Column, error)
GetColumnsForTable uses PRAGMA table_info directly instead of GORM's DDL parser, which fails on Unicode table/column names due to ASCII-only regex.
func (*Sqlite3Plugin) GetCreateTableQuery ¶
func (*Sqlite3Plugin) GetDatabases ¶
func (p *Sqlite3Plugin) GetDatabases(config *engine.PluginConfig) ([]string, error)
func (*Sqlite3Plugin) GetForeignKeyRelationships ¶
func (p *Sqlite3Plugin) GetForeignKeyRelationships(config *engine.PluginConfig, schema string, storageUnit string) (map[string]*engine.ForeignKeyRelationship, error)
func (*Sqlite3Plugin) GetGraphQueryDB ¶
func (*Sqlite3Plugin) GetLastInsertID ¶
func (p *Sqlite3Plugin) GetLastInsertID(db *gorm.DB) (int64, error)
GetLastInsertID returns the most recently auto-generated ID using SQLite's last_insert_rowid().
func (*Sqlite3Plugin) GetMaxBulkInsertParameters ¶
func (p *Sqlite3Plugin) GetMaxBulkInsertParameters() int
GetMaxBulkInsertParameters returns 999 for SQLite.
func (*Sqlite3Plugin) GetOrderedColumnsWithTypes ¶
func (p *Sqlite3Plugin) GetOrderedColumnsWithTypes(db *gorm.DB, schema, tableName string) ([]engine.Column, map[string]gorm_plugin.ColumnTypeInfo, error)
GetOrderedColumnsWithTypes uses PRAGMA table_info directly instead of GORM's DDL parser.
func (*Sqlite3Plugin) GetPlaceholder ¶
func (p *Sqlite3Plugin) GetPlaceholder(index int) string
func (*Sqlite3Plugin) GetPrimaryKeyColQuery ¶
func (p *Sqlite3Plugin) GetPrimaryKeyColQuery() string
func (*Sqlite3Plugin) GetPrimaryKeyColumns ¶
func (p *Sqlite3Plugin) GetPrimaryKeyColumns(db *gorm.DB, schema string, tableName string) ([]string, error)
GetPrimaryKeyColumns overrides the base implementation because SQLite's primary key query takes only a table name parameter (no schema).
func (*Sqlite3Plugin) GetRows ¶
func (p *Sqlite3Plugin) GetRows(config *engine.PluginConfig, req *engine.GetRowsRequest) (*engine.GetRowsResult, error)
GetRows overrides the base GORM implementation to handle SQLite datetime quirks
func (*Sqlite3Plugin) GetSSLStatus ¶
func (p *Sqlite3Plugin) GetSSLStatus(config *engine.PluginConfig) (*engine.SSLStatus, error)
GetSSLStatus returns nil for SQLite as it's a local file-based database that doesn't use network connections or SSL/TLS.
func (*Sqlite3Plugin) GetStorageUnitExistsQuery ¶
func (p *Sqlite3Plugin) GetStorageUnitExistsQuery() string
func (*Sqlite3Plugin) GetSupportedOperators ¶
func (p *Sqlite3Plugin) GetSupportedOperators() map[string]string
func (*Sqlite3Plugin) GetTableInfoQuery ¶
func (p *Sqlite3Plugin) GetTableInfoQuery() string
func (*Sqlite3Plugin) GetTableNameAndAttributes ¶
func (*Sqlite3Plugin) IsTableStrict ¶
func (p *Sqlite3Plugin) IsTableStrict(db *gorm.DB, tableName string) bool
IsTableStrict checks if a table is STRICT using PRAGMA table_list Returns false if detection fails or SQLite version doesn't support STRICT tables
func (*Sqlite3Plugin) MarkGeneratedColumns ¶
func (p *Sqlite3Plugin) MarkGeneratedColumns(config *engine.PluginConfig, schema string, storageUnit string, columns []engine.Column) error
MarkGeneratedColumns detects SQLite auto-increment (INTEGER PRIMARY KEY) and generated columns (via PRAGMA table_xinfo hidden flags).
func (*Sqlite3Plugin) NormalizeType ¶
func (p *Sqlite3Plugin) NormalizeType(typeName string) string
NormalizeType converts SQLite type aliases to their canonical form.
func (*Sqlite3Plugin) RawExecute ¶
func (p *Sqlite3Plugin) RawExecute(config *engine.PluginConfig, query string, params ...any) (*engine.GetRowsResult, error)
func (*Sqlite3Plugin) StreamRawExecute ¶
func (p *Sqlite3Plugin) StreamRawExecute(config *engine.PluginConfig, query string, writer engine.QueryStreamWriter, params ...any) error
StreamRawExecute streams a SQLite raw query row by row while preserving datetime text values that the driver would otherwise coerce to zero time.