Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Static Config Schema #23

Open
qhquanghuy opened this issue Aug 20, 2021 · 0 comments
Open

Static Config Schema #23

qhquanghuy opened this issue Aug 20, 2021 · 0 comments

Comments

@qhquanghuy
Copy link

qhquanghuy commented Aug 20, 2021

Maybe static schema for config is easier to work with. Eg:

ddl: "create_or_replace_table:hogehoge"

instead of

create_or_replace_table: hogehoge

Then we can make a sum type from that ddl like:

enum: SnowflakeDDL(val target: String):
  case CreateOrReplace(target: String) 
  case Create(target: String)

def parse(raw: String): Try[Throwable, SnowflakeDDL] = ....
def ddl(x: SnowflakeDDL): String = x match {
  case CreateOrReplace(target) => s"CREATE OR REPLACE TABLE"
}

This ensures user provide only 1 ddl verb and also makes compiler complaint if you forget to handle new case

@qhquanghuy qhquanghuy changed the title New Config Schema Static Config Schema Aug 20, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant