feat: 完善扫描器、exec 及 schema 相关功能
- exec/scanner: 用 *interface{} 替换 **json.RawMessage 扫描目标,兼容 DuckDB 返回 map[string]interface{} 的场景;新增 toJSONRawMessage 转换函数
- exec/scanner: ScanVal 支持结构体指针,通过 JSON 中间层转换(DuckDB STRUCT 列)
- exec/scanner: 将 *sql.RawBytes 和 *[]byte 的处理从 ScanValContext 移入 scanner.ScanVal
- exec/query_executor: 简化 ScanValContext,移除私有 scan 方法
- exec: 补充 scanner 级别 ScanVal 测试用例
- internal/util/reflect: 重写 SafeSetVarValue,修复非指针 src 及 nil 指针字段的 panic
- internal/util/column_map: 恢复非匿名带标签结构体字段的展开逻辑
- schema: 新增 vector 列类型支持
- engine: 补充 DuckDB 相关配置
- dialect/sqlite3/vtab: 完善虚拟表适配器
- 各方言测试改用 sqlmock 虚拟连接
This commit is contained in:
@@ -13,7 +13,7 @@ import (
|
||||
)
|
||||
|
||||
var (
|
||||
sqlite3DefaultModifiers = []string{"VirtualAs", "StoredAs", "Hidden", "Nullable", "Default", "Increment"}
|
||||
sqlite3DefaultModifiers = []string{"Hidden", "Nullable", "Default", "Increment"}
|
||||
sqlite3Serials = []string{"bigInteger", "integer", "mediumInteger", "smallInteger", "tinyInteger"}
|
||||
)
|
||||
|
||||
@@ -191,6 +191,9 @@ func (this Sqlite3) GetColumnModifier(modifier string, bp *schema.Blueprint, col
|
||||
return "NOT NULL"
|
||||
}
|
||||
case "Default":
|
||||
if column.IsHidden() {
|
||||
return ""
|
||||
}
|
||||
if column.IsUseCurrent() {
|
||||
return " DEFAULT CURRENT_TIMESTAMP"
|
||||
}
|
||||
@@ -223,7 +226,10 @@ func (this Sqlite3) GetColumnType(column *schema.ColumnDefinition) string {
|
||||
case "text":
|
||||
return "text"
|
||||
case "integer":
|
||||
return this.GenerateSQL("INTEGER(?)", column.Length)
|
||||
if column.Length > 0 {
|
||||
return this.GenerateSQL("INTEGER(?)", column.Length)
|
||||
}
|
||||
return "INTEGER"
|
||||
case "bigInteger":
|
||||
return "bigint(20)"
|
||||
case "tinyInteger":
|
||||
@@ -252,6 +258,8 @@ func (this Sqlite3) GetColumnType(column *schema.ColumnDefinition) string {
|
||||
return "year"
|
||||
case "uuid":
|
||||
return "char(36)"
|
||||
case "vector":
|
||||
return this.GenerateSQL("float[?]", column.Length)
|
||||
}
|
||||
panic("Unsupported data type: " + column.Type)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user