Skip to content

Support non-driver.Value values in null.Value[T] #84

@preaction

Description

@preaction

When I try to use a custom type in null.Value[T], I get the following error trying to write to the database:

"sql: converting argument $4 type: non-Value type date.Date returned from Value"

I think this is because sql.Null says it only supports types supported by driver.Value, and driver.Value says it only supports these types. Specifically, sql.Null[T] does not call T.Value(), so the only types that can be used currently in null.Value[T] are those directly supported by driver.Value.

If null.Value[T] had a Value() (driver.Value, error) method that delegated to T.Value(), then I think it would work to use any type in null.Value.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions