Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
Hypothetical: If SQL were immediately type-safe in your static language
1 point by owlstuffing on Oct 23, 2023 | hide | past | favorite
Hypothetical: If SQL were immediately type-safe in your static language... What would be your preferred means of customizing projected entity and query types/classes?

Note, this is actual SQL, not a DSL approximating it.

Let's assume a domain model is the target.

"Type-safe" means types for ALL of SQL are present:

- DDL (entities)

- SQL selects (queries)

- query results

"Immediate" means no code gen build steps.

Options for customizing types include:

- allow for the super type to be supplied (for common behavior, not state)

- allow for entity classes to be supplied (user-supplied entity class would subclass/compose projected one)

- class extensions / extension methods

- utilize delegation. The assumption is generated types are interfaces.

- something else?



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: