Skip to content

Can't override 'bigint' to be uint32 #3184

@MisterSweety

Description

@MisterSweety

Version

Other

What happened?

I am writing a service which can receive uint32 values that it has to persist in a postgres database. I am using sqlc to generate the go code to interact with the database. My database design uses 'bigint' for these id columns. By default the generated code expects the type int64 for the bigint id fields but I want to override this to be uint32 as that is more inline with reality. However, adjusting my sqlc.yaml file to include this override does not have the desired effect as the generated code still expects int64

Relevant log output

No response

Database schema

No response

SQL queries

No response

Configuration

version: '2'
sql:
  - schema: './../../../../cmd/postgres/migrations'
    queries: './queries'
    engine: 'postgresql'
    strict_order_by: false
    gen:
      go:
        package: 'generated'
        out: 'PGgenerated'
        emit_json_tags: true
        json_tags_case_style: 'snake'
        overrides:
          - db_type: pg_catalog.bigint
            go_type: uint32


### Playground URL

_No response_

### What operating system are you using?

macOS

### What database engines are you using?

PostgreSQL

### What type of code are you generating?

Go

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingquestionFurther information is requested

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions