Skip to content

Allow scanning rows to interface{} type #478

Closed
@usrlocl

Description

@usrlocl

I would like to be able to specify interface{} types for Scan as so,

var col1 interface{}
conn.QueryRow(ctx, "SELECT foo FROM bar").Scan(&col1)

However, it throws the following error

converting String to *interface {} is unsupported

Doing this can allow for some generic behaviour when the column types are not known in the application.

It should be a straight forward change. Wondering if it was a conscious choice to not allow this or would you be open for a pull request?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions