Skip to content
This repository was archived by the owner on Jan 28, 2021. It is now read-only.

Commit 9b8ecfa

Browse files
Make qualifiedName type private to parse package
Signed-off-by: Alejandro García Montoro <alejandro.garciamontoro@gmail.com>
1 parent cb3b61c commit 9b8ecfa

File tree

3 files changed

+11
-11
lines changed

3 files changed

+11
-11
lines changed

sql/parse/util.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -517,18 +517,18 @@ func maybeList(opening, separator, closing rune, list *[]string) parseFunc {
517517
}
518518
}
519519

520-
// A QualifiedName represents an identifier of type "db_name.table_name"
521-
type QualifiedName struct {
520+
// A qualifiedName represents an identifier of type "db_name.table_name"
521+
type qualifiedName struct {
522522
qualifier string
523523
name string
524524
}
525525

526-
// readQualifiedIdentifierList reads a comma-separated list of QualifiedNames.
526+
// readQualifiedIdentifierList reads a comma-separated list of qualifiedNames.
527527
// Any number of spaces between the qualified names are accepted. The qualifier
528528
// may be empty, in which case the period is optional.
529529
// An example of a correctly formed list is:
530530
// "my_db.myview, db_2.mytable , aTable"
531-
func readQualifiedIdentifierList(list *[]QualifiedName) parseFunc {
531+
func readQualifiedIdentifierList(list *[]qualifiedName) parseFunc {
532532
return func(rd *bufio.Reader) error {
533533
for {
534534
var newItem []string
@@ -559,7 +559,7 @@ func readQualifiedIdentifierList(list *[]QualifiedName) parseFunc {
559559
name = newItem[1]
560560
}
561561

562-
*list = append(*list, QualifiedName{qualifier, name})
562+
*list = append(*list, qualifiedName{qualifier, name})
563563

564564
r, _, err := rd.ReadRune()
565565
if err != nil {

sql/parse/util_test.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -474,19 +474,19 @@ func TestReadQualifiedIdentifierList(t *testing.T) {
474474

475475
testFixtures := []struct {
476476
string string
477-
expectedList []QualifiedName
477+
expectedList []qualifiedName
478478
expectedError bool
479479
expectedRemaining string
480480
}{
481481
{
482482
"my_db.myview, db_2.mytable , aTable",
483-
[]QualifiedName{{"my_db", "myview"}, {"db_2", "mytable"}, {"", "aTable"}},
483+
[]qualifiedName{{"my_db", "myview"}, {"db_2", "mytable"}, {"", "aTable"}},
484484
false,
485485
"",
486486
},
487487
{
488488
"single_identifier -remaining",
489-
[]QualifiedName{{"", "single_identifier"}},
489+
[]qualifiedName{{"", "single_identifier"}},
490490
false,
491491
"-remaining",
492492
},
@@ -498,15 +498,15 @@ func TestReadQualifiedIdentifierList(t *testing.T) {
498498
},
499499
{
500500
"partial_list,",
501-
[]QualifiedName{{"", "partial_list"}},
501+
[]qualifiedName{{"", "partial_list"}},
502502
true,
503503
"",
504504
},
505505
}
506506

507507
for _, fixture := range testFixtures {
508508
reader := bufio.NewReader(strings.NewReader(fixture.string))
509-
var actualList []QualifiedName
509+
var actualList []qualifiedName
510510

511511
err := readQualifiedIdentifierList(&actualList)(reader)
512512

sql/parse/views.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ func parseDropView(ctx *sql.Context, s string) (sql.Node, error) {
9898
r := bufio.NewReader(strings.NewReader(s))
9999

100100
var (
101-
views []QualifiedName
101+
views []qualifiedName
102102
ifExists bool
103103
unusedBool bool
104104
)

0 commit comments

Comments
 (0)