gavlyukovskiy/spring-boot-data-source-decorator

Add SQL Format Option

Closed this issue · 4 comments

Add SQL Format Option so that sql log can look feels good.

Like on Spring Boot properties
spring.jpa.properties.hibernate.format_sql=true

Name:dataSource, Connection:7, Time:20, Success:True
Type:Prepared, Batch:False, QuerySize:1, BatchSize:0
Query:["select u1_0.id,u1_0.active,u1_0.confirmation_token,u1_0.email,u1_0.fullname,u1_0.password,u1_0.phone,u1_0.username,u1_1.station_id from user_account u1_0 left join users_station u1_1 on u1_0.id=u1_1.user_id where u1_0.email=?"]
Params:[(user001@yopmail.com)]

It would be better like this:

Name:dataSource, Connection:7, Time:20, Success:True
Type:Prepared, Batch:False, QuerySize:1, BatchSize:0
Query:["
SELECT u1_0.id,
       u1_0.active,
       u1_0.confirmation_token,
       u1_0.email,
       u1_0.fullname,
       u1_0.password,
       u1_0.phone,
       u1_0.username,
       u1_1.station_id
FROM user_account u1_0
         LEFT JOIN users_station u1_1 ON u1_0.id = u1_1.user_id
WHERE u1_0.email=?;
"]
Params:[(user001@yopmail.com)]

Thanks

@hendisantika since this project only provides integration with datasource-proxy and p6spy, but doesn't extend their functionality - the formatting is better to be requested in those libraries.

Which libraries @gavlyukovskiy ?