entc/gen: add support for summing custom Go numeric types

This commit is contained in:
Ariel Mashraki
2021-06-25 15:24:35 +03:00
committed by Ariel Mashraki
parent ee4fa653fd
commit c40ae45aee
33 changed files with 869 additions and 55 deletions

View File

@@ -122,6 +122,8 @@ func (*SQLite) cType(c *Column) (t string) {
t = "json"
case field.TypeUUID:
t = "uuid"
case field.TypeOther:
t = c.typ
default:
panic(fmt.Sprintf("unsupported type %q for column %q", c.Type, c.Name))
}
@@ -303,6 +305,8 @@ func (d *SQLite) scanColumn(c *Column, rows *sql.Rows) error {
case "varchar", "text":
c.Size = DefaultStringLen
c.Type = field.TypeString
case "decimal", "numeric":
c.Type = field.TypeOther
}
if defaults.Valid {
return c.ScanDefault(defaults.String)