Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Sounds a bit like the Active Record/Repository pattern? The "meta sql" in that case is a natural language DSL, e.g.

    @Repository interface Employees : CrudRepository<Employee, Integer> {
        fun findBySalaryGreaterThanForUpdate(salary: Int): List<Employee>

        data class NameAndSalary(val name: String, val salary: Int)
        fun findByDepartment(department: String): List<NameAndSalary>
    }
The compiler reads the method name and writes the equivalent SQL query at compile time. The custom data class acts as a projection. This sort of thing can be found in Micronaut Data, or Spring or similar.


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

Search: