Skip to content

config overrides - support additional imports for go generics  #1662

Open
@krhubert

Description

@krhubert

What do you want to change?

Hi,

it would be great to allow add more imports when overriding db types. Let's say we have a Null package like below.

package null

type Null[T any] struct {
  V     T
  Valid bool
}

Now I want to set a custom nullable ts type in config as follows:

  - db_type: "pg_catalog.timestamp"
    nullable: true
    go_type:
      import: "github.com/myproject/null"
      type: "Null[time.Time]"

But this won't import "time" pkg.

Solution

Allow to specify imports instead of import. With this change config will look like:

  - db_type: "pg_catalog.timestamp"
    nullable: true
    go_type:
      imports:
      - "time" 
      - "github.com/myproject/null"
      type: "null.Null[time.Time]"

What database engines need to be changed?

N/A

What programming language backends need to be changed?

Go

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions