Skip to content

PostgresSQL access on rows.Scan fails for varchar fields #15

@ghost

Description

Hello Gophercast crew -

Appreciate the lessons. Quite new to Go and been trying out your tutorials. Using Go 1.4 on Ubuntu.

From a Python / Java / SQL background and Go has been a great language.

Getting an error on the rows.Scan - on fields that are VARCHAR in Postgres.
sql: Scan error on column index 1: unsupported driver -> Scan pair: -> *string

Do not get the erro if the fields are CHAR.

I updated the names of libraries for myself and it compiles and such - and even runs.
But get this other error when I get to templates (ie if I pass the above error in Lesson 4).

I get an error in that a field I am using in the struct to store the variables is unexportable.

template: members:9:9: executing "members" at <.ihg_member_id>: ihg_member_id is an unexported field of struct type main.Member

So I am using a struct Members instead of the Books table you showed - but does the same thing.
And I can access Memebers fine if the fields ar CHAR but not VARCHAR.

Your help would be very appreciated.

Thank you.

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