Closed
Description
Hey!
For example, I have a schema
CREATE TYPE tag AS ENUM ('new', 'stock', 'top');
CREATE TABLE some_table (
...
mainTag tag
...
)
You can see that the mainTag field in the table can be null.
And for the corresponding table, 'sqlc' generates me the following code
type TagType string
const (
TagTypeNew TagType = "new"
TagTypeStock TagType = "stock"
TagTypeTop TagType = "top"
)
func (e *TagType) Scan(src interface{}) error {
switch s := src.(type) {
case []byte:
*e = TagType(s)
case string:
*e = TagType(s)
default:
return fmt.Errorf("unsupported scan type for TagType: %T", src)
}
return nil
}
After I try to translate data from the database, I always get an error in the default case: "unsupported scan type for ...."
Question.
SQLC can track that this field can have a NULL value in the schema?