fix: make codegen not fail for "blob" columns

- was previously using "[]byte" as a single `ast.NewIdent`, which made comment+blank-line-insertion reparsing fail
This commit is contained in:
2026-02-14 18:33:41 -08:00
parent e53546a7f5
commit 29787b5521
3 changed files with 52 additions and 42 deletions

View File

@@ -57,29 +57,6 @@ func (c Column) GoVarName() string {
return strings.ToLower(fieldname)[0:1] + fieldname[1:]
}
func (c Column) GoTypeName() string {
if c.IsNonCodeTableForeignKey() {
return TypenameFromTablename(c.ForeignKeyTargetTable) + "ID"
}
switch c.Type {
case "integer", "int":
if strings.HasPrefix(c.Name, "is_") || strings.HasPrefix(c.Name, "has_") {
return "bool"
} else if strings.HasSuffix(c.Name, "_at") {
return "Timestamp"
}
return "int"
case "text":
return "string"
case "real":
return "float32"
case "blob":
return "[]byte"
default:
panic("Unrecognized sqlite column type: " + c.Type)
}
}
// Table is a single SQLite table.
type Table struct {
TableName string `db:"name"`