Skip to content

Code generated from table with no primary key does not compile #29

@stub42

Description

@stub42

Code generated from a table with no primary key does not compile:

db/schema/subnet.go:10: imported and not used: "fmt"
db/schema/subnet.go:31: cannot use 0 (type int) as type Subnet in return argument

The first error is that the fmt package is only used in a section of the template included if the table has a primary key.
The second error is that 0 is being returned as a dummy value instead of nil. Solution here is probably to not generate the Get method at all if it isn't going to work with no primary key.

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