Skip to content

Commit 8d56cd7

Browse files
committed
Rename UpdateItem*
1 parent a9b2381 commit 8d56cd7

26 files changed

+64
-64
lines changed

ast/ast.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -529,8 +529,8 @@ type UpdateItem interface {
529529
isUpdateItem()
530530
}
531531

532-
func (UpdateItemAssign) isUpdateItem() {}
533-
func (UpdateItemNested) isUpdateItem() {}
532+
func (UpdateItemSetValue) isUpdateItem() {}
533+
func (UpdateItemDML) isUpdateItem() {}
534534

535535
// ChangeStreamFor represents FOR clause in CREATE/ALTER CHANGE STREAM statement.
536536
type ChangeStreamFor interface {
@@ -3740,21 +3740,21 @@ type Update struct {
37403740
ThenReturn *ThenReturn // optional
37413741
}
37423742

3743-
// UpdateItemNested is nested update node in UPDATE statement.
3743+
// UpdateItemDML is nested update UpdateItem node in UPDATE statement.
37443744
//
37453745
// ({{.DML | sql}})
3746-
type UpdateItemNested struct {
3746+
type UpdateItemDML struct {
37473747
// pos = Lparen
37483748
// end = Rparen + 1
37493749

37503750
Lparen, Rparen token.Pos // position of "(", ")"
37513751
DML DML
37523752
}
37533753

3754-
// UpdateItemAssign is assignment node in UPDATE statement .
3754+
// UpdateItemSetValue is assignment style UpdateItem node in UPDATE statement .
37553755
//
37563756
// {{.Path | sqlJoin "."}} = {{.DefaultExpr | sql}}
3757-
type UpdateItemAssign struct {
3757+
type UpdateItemSetValue struct {
37583758
// pos = Path[0].pos
37593759
// end = DefaultExpr.end
37603760

ast/pos.go

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

ast/sql.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1253,11 +1253,11 @@ func (u *Update) SQL() string {
12531253
sqlOpt(" ", u.ThenReturn, "")
12541254
}
12551255

1256-
func (u *UpdateItemAssign) SQL() string {
1256+
func (u *UpdateItemSetValue) SQL() string {
12571257
return sqlJoin(u.Path, ".") + " = " + u.DefaultExpr.SQL()
12581258
}
12591259

1260-
func (u *UpdateItemNested) SQL() string {
1260+
func (u *UpdateItemDML) SQL() string {
12611261
return "(" + u.DML.SQL() + ")"
12621262
}
12631263

parser.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4897,7 +4897,7 @@ func (p *Parser) parseUpdateItem() ast.UpdateItem {
48974897
lparen := p.expect("(").Pos
48984898
dml := p.parseDML(true)
48994899
rparen := p.expect(")").Pos
4900-
return &ast.UpdateItemNested{
4900+
return &ast.UpdateItemDML{
49014901
Lparen: lparen,
49024902
Rparen: rparen,
49034903
DML: dml,
@@ -4908,7 +4908,7 @@ func (p *Parser) parseUpdateItem() ast.UpdateItem {
49084908
p.expect("=")
49094909
defaultExpr := p.parseDefaultExpr()
49104910

4911-
return &ast.UpdateItemAssign{
4911+
return &ast.UpdateItemSetValue{
49124912
Path: path,
49134913
DefaultExpr: defaultExpr,
49144914
}

testdata/result/dml/nested_update_delete_update_insert.sql.txt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ WHERE SingerId = 3 AND s.Albums.title = 'Go! Go! Go!'
2525
},
2626
},
2727
Updates: []ast.UpdateItem{
28-
&ast.UpdateItemNested{
28+
&ast.UpdateItemDML{
2929
Lparen: 23,
3030
Rparen: 85,
3131
DML: &ast.Delete{
@@ -84,7 +84,7 @@ WHERE SingerId = 3 AND s.Albums.title = 'Go! Go! Go!'
8484
},
8585
},
8686
},
87-
&ast.UpdateItemNested{
87+
&ast.UpdateItemDML{
8888
Lparen: 90,
8989
Rparen: 204,
9090
DML: &ast.Update{
@@ -117,7 +117,7 @@ WHERE SingerId = 3 AND s.Albums.title = 'Go! Go! Go!'
117117
},
118118
},
119119
Updates: []ast.UpdateItem{
120-
&ast.UpdateItemAssign{
120+
&ast.UpdateItemSetValue{
121121
Path: []*ast.Ident{
122122
&ast.Ident{
123123
NamePos: 121,
@@ -167,7 +167,7 @@ WHERE SingerId = 3 AND s.Albums.title = 'Go! Go! Go!'
167167
},
168168
},
169169
},
170-
&ast.UpdateItemNested{
170+
&ast.UpdateItemDML{
171171
Lparen: 209,
172172
Rparen: 275,
173173
DML: &ast.Insert{

testdata/result/dml/nested_update_insert_song.sql.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ WHERE s.SingerId = 5 AND s.AlbumInfo.title = "Fire is Hot"
2323
},
2424
},
2525
Updates: []ast.UpdateItem{
26-
&ast.UpdateItemNested{
26+
&ast.UpdateItemDML{
2727
Lparen: 21,
2828
Rparen: 105,
2929
DML: &ast.Insert{

testdata/result/dml/nested_update_insert_song_path.sql.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ WHERE s.SingerId = 5 and s.AlbumInfo.title = "Fire is Hot"
2424
},
2525
},
2626
Updates: []ast.UpdateItem{
27-
&ast.UpdateItemNested{
27+
&ast.UpdateItemDML{
2828
Lparen: 21,
2929
Rparen: 102,
3030
DML: &ast.Insert{
@@ -69,7 +69,7 @@ WHERE s.SingerId = 5 and s.AlbumInfo.title = "Fire is Hot"
6969
},
7070
},
7171
},
72-
&ast.UpdateItemAssign{
72+
&ast.UpdateItemSetValue{
7373
Path: []*ast.Ident{
7474
&ast.Ident{
7575
NamePos: 109,

testdata/result/dml/nested_update_insert_string.sql.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ WHERE s.SingerId = 5 AND s.AlbumInfo.title = "Fire is Hot"
2323
},
2424
},
2525
Updates: []ast.UpdateItem{
26-
&ast.UpdateItemNested{
26+
&ast.UpdateItemDML{
2727
Lparen: 21,
2828
Rparen: 73,
2929
DML: &ast.Insert{

testdata/result/dml/nested_update_update_nested_insert.sql.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ WHERE s.SingerId = 5
2525
},
2626
},
2727
Updates: []ast.UpdateItem{
28-
&ast.UpdateItemNested{
28+
&ast.UpdateItemDML{
2929
Lparen: 21,
3030
Rparen: 175,
3131
DML: &ast.Update{
@@ -58,7 +58,7 @@ WHERE s.SingerId = 5
5858
},
5959
},
6060
Updates: []ast.UpdateItem{
61-
&ast.UpdateItemNested{
61+
&ast.UpdateItemDML{
6262
Lparen: 57,
6363
Rparen: 135,
6464
DML: &ast.Insert{

testdata/result/dml/nested_update_update_nested_update.sql.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ WHERE s.SingerId = 5
2626
},
2727
},
2828
Updates: []ast.UpdateItem{
29-
&ast.UpdateItemNested{
29+
&ast.UpdateItemDML{
3030
Lparen: 21,
3131
Rparen: 189,
3232
DML: &ast.Update{
@@ -59,7 +59,7 @@ WHERE s.SingerId = 5
5959
},
6060
},
6161
Updates: []ast.UpdateItem{
62-
&ast.UpdateItemNested{
62+
&ast.UpdateItemDML{
6363
Lparen: 58,
6464
Rparen: 148,
6565
DML: &ast.Update{
@@ -87,7 +87,7 @@ WHERE s.SingerId = 5
8787
},
8888
},
8989
Updates: []ast.UpdateItem{
90-
&ast.UpdateItemAssign{
90+
&ast.UpdateItemSetValue{
9191
Path: []*ast.Ident{
9292
&ast.Ident{
9393
NamePos: 91,

0 commit comments

Comments
 (0)