ngs-doo / revenj

DSL Platform compatible backend

Home Page:https://dsl-platform.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Nullable reference entity with composite key

Kobus-Smit opened this issue · comments

Hi @zapov

How can I get this dsl to compile?

module test {

root account(id) {
  long id { sequence; }
  string? currency_id;
  currency_type? currency_type;
  currency(currency_id, currency_type)? *currency;
}

root currency(id, type) {
  string id;
  currency_type type;
}

enum currency_type {                  
  aaa;
  zzz;
}                 

}                   
Error during compilation:
The best overloaded method match for '_DatabaseCommon.Factorytest_currency.currencyConverter.BuildURI(char[], string, test.currency_type)' has some invalid arguments
Argument 3: cannot convert from 'test.currency_type?' to 'test.currency_type'
The best overloaded method match for '_DatabaseCommon.Factorytest_currency.currencyConverter.BuildURI(char[], string, test.currency_type)' has some invalid arguments
Argument 3: cannot convert from 'test.currency_type?' to 'test.currency_type'
commented

I've fixed this and have released a new compiler.
Btw there is a new database naming feature where you can specify different name for table/column in entity. In this case you could do

root Account(id) {
  database { postgres name account; }
  string? currencyId { postgres name currency_id; }
....

Super! Thanks @zapov

I like that new database naming feature!
I first had my dsl in camelCase which looks good in C# but I grew tired of the double quoting in our custom Postgres sql, so I changed it all to lower_case which then look funny in C# :)