Skip to content

SELECT foo.id AS foo_id loses Go type information #606

Closed
@tv42

Description

@tv42

I'm trying to use custom Go types for some SQL columns, mapping a sql int64 to Go type FooID uint64.

It seems I can have

SELECT foo.id FROM ... and get generated type FooRow struct { ID FooID }

or I can have

SELECT foo.id AS foo_id FROM ... and get type FooRow struct { FooID int64 }

but I cannot get both at the same time. Using the AS forgets the association with the Go type, but without the AS my struct fields are kinda misleading. Consider SELECT foo.id, bar.id FROM ..., can't have two things fighting for the struct field name ID.

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