Skip to content

Export models to a different package #835

Open
@td0m

Description

@td0m

Hi! Great work on this project!

I was wondering if it's currently possible to export Go model structs to a different folder package.

I think this could be a good feature for anyone who would like to make their code independent of the database backend but still use the automatically generated models.

For example:

internal/
  model/
    models.go
  db/
    postgres/
      db.go
      user.sql.go
      querier.go

This way you could e.g. also have a mongodb provider that uses these models, but without depending on the postgres package. I'm sure you'd agree that it would be odd for mongo to use postgres.User as a type.

Is this something that's possible to do? If not, would you possibly accept a PR that adds support for it? Or it it something you're not planning on supporting for now?

Thanks

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    Status

    🔍 Exploring

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions