JordanMarr / SqlHydra

SqlHydra is a suite of NuGet packages for working with databases in F# including code generation tools and query expressions.
MIT License
212 stars 21 forks source link

Question: Can you exclude a column from being in a generated type? #6

Closed Mousaka closed 2 years ago

Mousaka commented 2 years ago

We would like to add a created_at column to a table that our PostgresSQL that always gets set by our DB. Is there a way to exclude this column when generating the type that represents this row, since we never use it in our program? The column is only used for debugging purposes.

JordanMarr commented 2 years ago

The filters currently accept:

The ability to filter columns sounds useful. I think the filters could be augmented to allow this, but it would have to be fully qualified:

This is based on my assumption none of the other database providers allow nested schemas. if it turns out that any of them do, then it would would be better to use a different delimiter to indicate columns, such as:

In fact maybe that would be better anyway since it would also allow leaving off the schema:

Mousaka commented 2 years ago

I see! thanks for answering.

We can of course work around this by setting a dummy value when creating the generated type before serializing it with the excludeColumn-pattern. But would prefer to not have that field :)

JordanMarr commented 2 years ago

I will plan on adding this feature next. It should be fairly straight forward. 😀

JordanMarr commented 2 years ago

Just released: SqlHydra.Npgsql v0.540.0-beta1 I need to do some more testing, but thought you might want to kick the tires a bit.

JordanMarr commented 2 years ago

Were you able to try out this change to see if it works for your scenario?

JordanMarr commented 2 years ago

Implemented in v0.610.0.