Documentation
¶
Index ¶
- Constants
- Variables
- func GetSampleDatabase() (*gorm.DB, error)
- func GetSampleProfile() types.DatabaseCredentials
- func IsSampleDatabase(name string) bool
- func NewSqlite3Plugin() *engine.Plugin
- func NormalizeType(typeName string) string
- type DateTimeString
- type SQLiteSQLBuilder
- type Sqlite3Plugin
- func (p *Sqlite3Plugin) ConvertRawToRows(rows *sql.Rows) (*engine.GetRowsResult, error)
- func (p *Sqlite3Plugin) ConvertStringValue(value, columnType string) (interface{}, 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]interface{}, error)
- func (p *Sqlite3Plugin) GetCreateTableQuery(db *gorm.DB, schema string, storageUnit string, columns []engine.Record) string
- func (p *Sqlite3Plugin) GetDatabaseMetadata() *engine.DatabaseMetadata
- 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) GetPlaceholder(index int) string
- func (p *Sqlite3Plugin) GetPrimaryKeyColQuery() string
- func (p *Sqlite3Plugin) GetRows(config *engine.PluginConfig, schema string, storageUnit string, ...) (*engine.GetRowsResult, 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) NormalizeType(typeName string) string
- func (p *Sqlite3Plugin) RawExecute(config *engine.PluginConfig, query string) (*engine.GetRowsResult, error)
Constants ¶
const SampleDatabaseName = "whodb-sample"
Variables ¶
var AliasMap = map[string]string{
"INT": "INTEGER",
"TINYINT": "INTEGER",
"SMALLINT": "INTEGER",
"MEDIUMINT": "INTEGER",
"BIGINT": "INTEGER",
"INT2": "INTEGER",
"INT8": "INTEGER",
"DOUBLE": "REAL",
"DOUBLE PRECISION": "REAL",
"FLOAT": "REAL",
"CHARACTER": "TEXT",
"VARCHAR": "TEXT",
"VARYING CHARACTER": "TEXT",
"NCHAR": "TEXT",
"NATIVE CHARACTER": "TEXT",
"NVARCHAR": "TEXT",
"CLOB": "TEXT",
"CHAR": "TEXT",
"DECIMAL": "NUMERIC",
"BOOL": "BOOLEAN",
"TIMESTAMP": "DATETIME",
}
AliasMap maps SQLite type aliases to their canonical storage class or affinity. SQLite's type affinity rules mean many types map to the same storage class. All keys and values are UPPERCASE.
var TypeDefinitions = []engine.TypeDefinition{ {ID: "NULL", Label: "NULL", Category: engine.TypeCategoryOther}, {ID: "INTEGER", Label: "INTEGER", Category: engine.TypeCategoryNumeric}, {ID: "REAL", Label: "REAL", Category: engine.TypeCategoryNumeric}, {ID: "TEXT", Label: "TEXT", Category: engine.TypeCategoryText}, {ID: "BLOB", Label: "BLOB", Category: engine.TypeCategoryBinary}, {ID: "NUMERIC", Label: "NUMERIC", Category: engine.TypeCategoryNumeric}, {ID: "BOOLEAN", Label: "BOOLEAN", Category: engine.TypeCategoryBoolean}, {ID: "DATE", Label: "DATE", Category: engine.TypeCategoryDatetime}, {ID: "DATETIME", Label: "DATETIME", Category: engine.TypeCategoryDatetime}, }
TypeDefinitions contains the canonical SQLite types with metadata for UI.
Functions ¶
func GetSampleDatabase ¶
func GetSampleProfile ¶
func GetSampleProfile() types.DatabaseCredentials
func IsSampleDatabase ¶
func NewSqlite3Plugin ¶
func NormalizeType ¶
NormalizeType converts a SQLite type alias to its canonical form.
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 interface{}) 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) (interface{}, 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]interface{}, error)
GetColumnConstraints retrieves column constraints for SQLite tables
func (*Sqlite3Plugin) GetCreateTableQuery ¶
func (*Sqlite3Plugin) GetDatabaseMetadata ¶
func (p *Sqlite3Plugin) GetDatabaseMetadata() *engine.DatabaseMetadata
GetDatabaseMetadata returns SQLite metadata for frontend configuration.
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) GetPlaceholder ¶
func (p *Sqlite3Plugin) GetPlaceholder(index int) string
func (*Sqlite3Plugin) GetPrimaryKeyColQuery ¶
func (p *Sqlite3Plugin) GetPrimaryKeyColQuery() string
func (*Sqlite3Plugin) GetRows ¶
func (p *Sqlite3Plugin) GetRows(config *engine.PluginConfig, schema string, storageUnit string, where *model.WhereCondition, sort []*model.SortCondition, pageSize, pageOffset int) (*engine.GetRowsResult, error)
GetRows overrides the base GORM implementation to handle SQLite datetime quirks
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) 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) (*engine.GetRowsResult, error)