MyGit

v3.6.0

kotlin-orm/ktorm

版本发布时间: 2023-01-29 21:50:17

kotlin-orm/ktorm最新发布版本:v4.1.1(2024-09-03 11:39:09)

Infrastructure

Support SQL Window Functions, by @michaelfyc in #460

Ktorm now supports SQL window functions, here is an example:

database
    .from(Employees)
    .select(
        Employees.name,
        Employees.salary,
        Employees.departmentId,
        rank().over { partitionBy(Employees.departmentId).orderBy(Employees.salary.desc()) }
    )

Generated SQL:

SELECT 
    "t_employee"."name" AS "t_employee_name", 
    "t_employee"."salary" AS "t_employee_salary", 
    "t_employee"."department_id" AS "t_employee_department_id", 
    RANK() OVER (PARTITION BY "t_employee"."department_id" ORDER BY "t_employee"."salary" DESC) 
FROM "t_employee" 

Support Case-When DSL, by @zuisong in #413

Ktorm now supports case-when DSL, for example:

database
    .from(Employees)
    .select(
        Employees.id,
        Employees.name,
        CASE(Employees.sex).WHEN(1).THEN("male").WHEN(2).THEN("female").ELSE("unknown").END()
    )

Generated SQL:

SELECT 
    "t_employee"."id" AS "t_employee_id", 
    "t_employee"."name" AS "t_employee_name", 
    CASE "t_employee"."sex" WHEN 1 THEN 'male' WHEN 2 THEN 'female' ELSE 'unknown' END 
FROM "t_employee" 

Other Optimizations & Bug Fixes

Break Changes

相关地址:原始地址 下载(tar) 下载(zip)

查看:2023-01-29发行的版本