tomasfabian / ksqlDB.RestApi.Client-DotNet

ksqlDb.RestApi.Client is a C# LINQ-enabled client API for issuing and consuming ksqlDB push and pull queries and executing statements.
MIT License
97 stars 26 forks source link

Specify IgnoreInDDL using both the model builder and the attribute. #93

Closed tomasfabian closed 1 month ago

tomasfabian commented 1 month ago

To exclude fields that are not supported for CREATE statements but allowed in INSERT statements, such as the RowTime pseudo column, a new function IgnoreInDDL should be introduced using the model builder, along with a corresponding attribute. Here's an example of how this can be implemented:

modelBuilder.Entity<Record>()
    .Property(r => r.RowTime)
    .IgnoreInDDL(); // This will exclude RowTime from CREATE but allow it in INSERT
[AttributeUsage(AttributeTargets.Field | AttributeTargets.Property)]
public class IgnoreInDDLAttribute : Attribute
{
}
mrt181 commented 1 month ago

Should this be a public API? 🤔

It only applies to RowTime, the only pseudo column that can be inserted into.

As a general API it will lead to errors for any other column definition.

The current implementation already ignores all pseudo columns in DDL Statements.

tomasfabian commented 1 month ago

I changed it to an internal implementation as you suggested see #94. Thank you @mrt181!

tomasfabian commented 1 month ago

A new version is available. Thanks a lot, @mrt181.

dotnet add package ksqlDb.RestApi.Client --version 6.4.0