Skip to content

Commit 33303d0

Browse files
Change default case format settings to lower (#16)
Co-authored-by: yamada2915 <[email protected]>
1 parent 43cd6ac commit 33303d0

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

89 files changed

+1447
-1447
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,8 @@ If there is no configuration file, the default values are used.
7474
| [`tab_size`](docs/options/tab_size.md) | int | Tab size used for formatting. | 4 |
7575
| [`complement_alias`](docs/options/complement_alias.md) | bool | Complement aliases. Currently, column names are auto-completed with the same name. (e.g. `COL1``COL1 AS COL1`) | true |
7676
| [`trim_bind_param`](docs/options/trim_bind_param.md) | bool | Trim the contents of the [bind parameters](https://future-architect.github.io/uroborosql-doc/background/#%E3%83%8F%E3%82%99%E3%82%A4%E3%83%B3%E3%83%88%E3%82%99%E3%83%8F%E3%82%9A%E3%83%A9%E3%83%A1%E3%83%BC%E3%82%BF). (e.g. `/* foo */``/*foo*/`) | false |
77-
| [`keyword_case`](docs/options/keyword_case.md) | [`"upper"`, `"lower"`, `"preserve"`] | Unify the case of keywords. (No conversion in case of `"preserve"`) | upper |
78-
| [`identifier_case`](docs/options/identifier_case.md) | [`"upper"`, `"lower"`, `"preserve"`] | Unify the case of identifiers. (No conversion in case of `"preserve"`) | upper |
77+
| [`keyword_case`](docs/options/keyword_case.md) | [`"upper"`, `"lower"`, `"preserve"`] | Unify the case of keywords. (No conversion in case of `"preserve"`) | lower |
78+
| [`identifier_case`](docs/options/identifier_case.md) | [`"upper"`, `"lower"`, `"preserve"`] | Unify the case of identifiers. (No conversion in case of `"preserve"`) | lower |
7979
| [`max_char_per_line`](docs/options/max_char_per_line.md) | int | If the total number of characters in the function name and arguments exceeds `max_char_per_line`, the arguments are formatted with new lines. | 50 |
8080
| [`complement_outer_keyword`](docs/options/complement_outer_keyword.md) | bool | Complement the optional `OUTER`. (e.g. `LEFT JOIN``LEFT OUTER JOIN`) | true |
8181
| [`complement_column_as_keyword`](docs/options/complement_column_as_keyword.md) | bool | Complement `AS` in column aliases. | true |

crates/uroborosql-fmt/src/config.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,9 +74,9 @@ pub(crate) enum Case {
7474
}
7575

7676
impl Default for Case {
77-
/// Caseのデフォルト値(upper)
77+
/// Caseのデフォルト値(lower)
7878
fn default() -> Self {
79-
Case::Upper
79+
Case::Lower
8080
}
8181
}
8282

Lines changed: 45 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -1,61 +1,61 @@
1-
SELECT
2-
ID AS ID
3-
, CASE
4-
WHEN
5-
GRADE_POINT >= 80
6-
THEN
1+
select
2+
id as id
3+
, case
4+
when
5+
grade_point >= 80
6+
then
77
'A'
8-
WHEN
9-
GRADE_POINT < 80
10-
AND GRADE_POINT >= 70
11-
THEN
8+
when
9+
grade_point < 80
10+
and grade_point >= 70
11+
then
1212
'B'
13-
WHEN
14-
GRADE_POINT < 70
15-
AND GRADE_POINT >= 60
16-
THEN
13+
when
14+
grade_point < 70
15+
and grade_point >= 60
16+
then
1717
'C'
18-
ELSE
18+
else
1919
'D'
20-
END
21-
AS GRADE
22-
FROM
23-
RISYU
24-
WHERE
25-
SUBJECT_NUMBER = '005'
20+
end
21+
as grade
22+
from
23+
risyu
24+
where
25+
subject_number = '005'
2626
;
27-
SELECT
28-
ID AS ID
29-
, CASE
30-
GRADE
31-
WHEN
27+
select
28+
id as id
29+
, case
30+
grade
31+
when
3232
'A'
33-
THEN
33+
then
3434
5
35-
WHEN
35+
when
3636
'B'
37-
THEN
37+
then
3838
4
39-
WHEN
39+
when
4040
'C'
41-
THEN
41+
then
4242
3
43-
ELSE
43+
else
4444
0
45-
END
46-
AS P
47-
FROM
48-
RISYU
49-
WHERE
50-
SUBJECT_NUMBER = '006'
45+
end
46+
as p
47+
from
48+
risyu
49+
where
50+
subject_number = '006'
5151
;
52-
SELECT
53-
CASE
54-
/*param*/A -- simple case cond
55-
WHEN
52+
select
53+
case
54+
/*param*/a -- simple case cond
55+
when
5656
/*a*/'a'
57-
THEN
57+
then
5858
'A'
59-
ELSE
59+
else
6060
'B'
61-
END
61+
end
Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
SELECT
2-
CAST('2023-01-01' AS DATE)
3-
, CAST(100 AS CHAR(3))
4-
, CAST((1 + 2) AS CHAR(1))
5-
WHERE
6-
TEST = TEST
1+
select
2+
cast('2023-01-01' as date)
3+
, cast(100 as char(3))
4+
, cast((1 + 2) as char(1))
5+
where
6+
test = test
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
SELECT
2-
IDENTIFIER AS ID
3-
, STUDENT_NAME AS STUDENT_NAME
4-
FROM
5-
JAPANESE_STUDENT_TABLE
1+
select
2+
identifier as id
3+
, student_name as student_name
4+
from
5+
japanese_student_table
Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,36 @@
1-
SELECT
1+
select
22
*
3-
FROM
4-
T1
5-
INNER JOIN
6-
T2
7-
ON
8-
T1.NUM = T2.NUM
3+
from
4+
t1
5+
inner join
6+
t2
7+
on
8+
t1.num = t2.num
99
;
10-
SELECT
10+
select
1111
*
12-
FROM
13-
T1
14-
LEFT OUTER JOIN
15-
T2
16-
ON
17-
T1.NUM = T2.NUM
12+
from
13+
t1
14+
left outer join
15+
t2
16+
on
17+
t1.num = t2.num
1818
;
19-
SELECT
19+
select
2020
*
21-
FROM
22-
T1
23-
RIGHT OUTER JOIN
24-
T2
25-
ON
26-
T1.NUM = T2.NUM
21+
from
22+
t1
23+
right outer join
24+
t2
25+
on
26+
t1.num = t2.num
2727
;
28-
SELECT
28+
select
2929
*
30-
FROM
31-
T1
32-
FULL OUTER JOIN
33-
T2
34-
ON
35-
T1.NUM = T2.NUM
30+
from
31+
t1
32+
full outer join
33+
t2
34+
on
35+
t1.num = t2.num
3636
;
Lines changed: 34 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,44 @@
1-
SELECT
2-
CASE
3-
WHEN
4-
A = 1
5-
THEN
1+
select
2+
case
3+
when
4+
a = 1
5+
then
66
'one'
7-
ELSE
7+
else
88
'other'
9-
END
10-
AS GRADE
11-
FROM
12-
STUDENT STD
13-
WHERE
14-
GRADE BETWEEN /*start1*/60 AND /*end1*/100
15-
AND GRADE NOT BETWEEN /*start2*/70 AND /*end2*/80
9+
end
10+
as grade
11+
from
12+
student std
13+
where
14+
grade between /*start1*/60 and /*end1*/100
15+
and grade not between /*start2*/70 and /*end2*/80
1616
;
17-
UPDATE
18-
WEATHER
19-
SET
20-
(TEMP_LO, TEMP_HI, PRCP) = (TEMP_LO + 1, TEMP_LO + 15, DEFAULT)
21-
WHERE
22-
CITY = 'San Francisco'
17+
update
18+
weather
19+
set
20+
(temp_lo, temp_hi, prcp) = (temp_lo + 1, temp_lo + 15, default)
21+
where
22+
city = 'San Francisco'
2323
;
24-
DELETE
25-
FROM
26-
PRODUCTS
27-
WHERE
28-
OBSOLETION_DATE = 'today'
29-
RETURNING
24+
delete
25+
from
26+
products
27+
where
28+
obsoletion_date = 'today'
29+
returning
3030
*
3131
;
32-
INSERT
33-
INTO
34-
DISTRIBUTORS
32+
insert
33+
into
34+
distributors
3535
(
36-
DID
37-
, DNAME
38-
) VALUES (
39-
DEFAULT
36+
did
37+
, dname
38+
) values (
39+
default
4040
, 'XYZ Widgets'
4141
)
42-
RETURNING
43-
DID
42+
returning
43+
did
4444
;
Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,39 @@
1-
SELECT
2-
NORMAL_FUNC(COL1 + COL2, PARAM2)
1+
select
2+
normal_func(col1 + col2, param2)
33
;
4-
SELECT
5-
MANY_ARGS_FUNC(PARAM1, PARAM2, PARAM3, PARAM4)
4+
select
5+
many_args_func(param1, param2, param3, param4)
66
;
7-
SELECT
8-
LONG_ARGS_FUNC(
9-
COL1 + LONGLONGLONGLONGLONGLONGLONG
10-
, PARAM2
7+
select
8+
long_args_func(
9+
col1 + longlonglonglonglonglonglong
10+
, param2
1111
)
1212
;
13-
SELECT
14-
LONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONG_FUNC(
15-
PARAM1
16-
, PARAM2
17-
, PARAM3
13+
select
14+
longlonglonglonglonglonglonglonglonglonglonglong_func(
15+
param1
16+
, param2
17+
, param3
1818
)
1919
;
20-
SELECT
21-
FUNC1(
22-
CASE
23-
WHEN
24-
Z = 1
25-
THEN
26-
FUNC3(PARAM1, PARAM2, PARAM3, PARAM4, PARAM5)
27-
ELSE
28-
FUNC2(
29-
CASE
30-
WHEN
31-
Z = 1
32-
THEN
20+
select
21+
func1(
22+
case
23+
when
24+
z = 1
25+
then
26+
func3(param1, param2, param3, param4, param5)
27+
else
28+
func2(
29+
case
30+
when
31+
z = 1
32+
then
3333
'ONE'
34-
ELSE
35-
FUNC3(PARAM1, PARAM2, PARAM3, PARAM4, PARAM5)
36-
END
34+
else
35+
func3(param1, param2, param3, param4, param5)
36+
end
3737
)
38-
END
38+
end
3939
)
Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
SELECT
2-
COL AS COL
3-
FROM
4-
TAB
5-
ORDER BY
6-
COL ASC -- 昇順
7-
, LONG_COL DESC NULLS FIRST -- 降順
8-
, NULL_COL NULLS FIRST -- NULL先
1+
select
2+
col as col
3+
from
4+
tab
5+
order by
6+
col asc -- 昇順
7+
, long_col desc nulls first -- 降順
8+
, null_col nulls first -- NULL先

0 commit comments

Comments
 (0)