Skip to content

Cannot override with standard library type #2073

@earthboundkid

Description

@earthboundkid

Version

Other

What happened?

Trying to override a column to use a standard library type results in the error message:

error parsing sqlc.json: Package override `go_type` specifier "time.Time" is not the proper format, expected 'package.type', e.g. 'github.com/segmentio/ksuid.KSUID'

Workaround: instead of "go_type": "time.Time" use "go_type": {"import":"time", "type": "Time"}.

Relevant log output

No response

Database schema

CREATE TABLE authors (
  birthday timestamptz not null
);

SQL queries

-- name: ListAuthors :many
SELECT * FROM authors;

Configuration

{
  "version": "1",
  "packages": [
    {
      "path": "db",
      "engine": "postgresql",
      "schema": "query.sql",
      "queries": "query.sql"
    }
  ],
  "overrides": [
    {
      "column": "author.birthday",
	  "go_type": "time.Time"
    }
  ]
}

Playground URL

https://play.sqlc.dev/p/e18cc29a5239b31fd32a651118f35b7f1b038b2e921644cec196290000867266

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 workingtriageNew issues that hasn't been reviewed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions