Skip to content

Error while doing a MapScan or SliceScan time.Time with PostgreSQL #59

@frankbb

Description

@frankbb

Not really sure if it's a sqlx issue. When i use a MapScan or a SliceScan in combination with a Postgresql timestamp field it will result in a scan error, or did i miss something?

rows, err := db.NamedQuery(query, where)
[...] -> err
for rows.Next() {
        results := make(map[string]interface{})
        err = rows.MapScan(results)
        [...] -> err

        fmt.Println(fmt.Sprintf("%v", results)))
}

Error:

sql: Scan error on column index 3: unsupported driver -> Scan pair: time.Time -> *string

Database Postgresql column:

\d users
  Column  |            Type             |                     Modifiers
----------+-----------------------------+----------------------------------------------------
 id       | integer                     | not null default nextval('users_id_seq'::regclass)
 added    | timestamp without time zone | not null default now()

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