Skip to content

Commit

Permalink
update to latest vitess' sqlparser and go-git.v4.
Browse files Browse the repository at this point in the history
  • Loading branch information
smola committed Dec 23, 2016
1 parent 2fda359 commit c8b923f
Show file tree
Hide file tree
Showing 8 changed files with 19 additions and 14 deletions.
5 changes: 3 additions & 2 deletions git/blobs.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"github.com/gitql/gitql/sql"

"gopkg.in/src-d/go-git.v4"
"gopkg.in/src-d/go-git.v4/plumbing/object"
)

type blobsTable struct {
Expand Down Expand Up @@ -51,7 +52,7 @@ func (blobsTable) Children() []sql.Node {
}

type blobIter struct {
i *git.BlobIter
i *object.BlobIter
}

func (i *blobIter) Next() (sql.Row, error) {
Expand All @@ -63,7 +64,7 @@ func (i *blobIter) Next() (sql.Row, error) {
return blobToRow(blob), nil
}

func blobToRow(c *git.Blob) sql.Row {
func blobToRow(c *object.Blob) sql.Row {
return sql.NewMemoryRow(
c.Hash.String(),
c.Size,
Expand Down
5 changes: 3 additions & 2 deletions git/commits.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"github.com/gitql/gitql/sql"

"gopkg.in/src-d/go-git.v4"
"gopkg.in/src-d/go-git.v4/plumbing/object"
)

type commitsTable struct {
Expand Down Expand Up @@ -57,7 +58,7 @@ func (commitsTable) Children() []sql.Node {
}

type commitIter struct {
i *git.CommitIter
i *object.CommitIter
}

func (i *commitIter) Next() (sql.Row, error) {
Expand All @@ -68,7 +69,7 @@ func (i *commitIter) Next() (sql.Row, error) {
return commitToRow(commit), nil
}

func commitToRow(c *git.Commit) sql.Row {
func commitToRow(c *object.Commit) sql.Row {
return sql.NewMemoryRow(
c.Hash.String(),
c.Author.Name,
Expand Down
5 changes: 3 additions & 2 deletions git/objects.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"github.com/gitql/gitql/sql"

"gopkg.in/src-d/go-git.v4"
"gopkg.in/src-d/go-git.v4/plumbing/object"
)

type objectsTable struct {
Expand Down Expand Up @@ -51,7 +52,7 @@ func (objectsTable) Children() []sql.Node {
}

type objectIter struct {
i *git.ObjectIter
i *object.ObjectIter
}

func (i *objectIter) Next() (sql.Row, error) {
Expand All @@ -63,7 +64,7 @@ func (i *objectIter) Next() (sql.Row, error) {
return objectToRow(o), nil
}

func objectToRow(o git.Object) sql.Row {
func objectToRow(o object.Object) sql.Row {
return sql.NewMemoryRow(
o.ID().String(),
o.Type().String(),
Expand Down
2 changes: 1 addition & 1 deletion git/references.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ func (r *referencesTable) TransformExpressionsUp(f func(sql.Expression) sql.Expr
}

func (r referencesTable) RowIter() (sql.RowIter, error) {
rIter, err := r.r.Refs()
rIter, err := r.r.References()
if err != nil {
return nil, err
}
Expand Down
2 changes: 1 addition & 1 deletion git/references_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ func TestReferencesTable_RowIter(t *testing.T) {

rows, err := sql.NodeToRows(table)
assert.Nil(err)
assert.Len(rows, 5)
assert.Len(rows, 7)

schema := table.Schema()
for idx, row := range rows {
Expand Down
5 changes: 3 additions & 2 deletions git/tags.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"github.com/gitql/gitql/sql"

"gopkg.in/src-d/go-git.v4"
"gopkg.in/src-d/go-git.v4/plumbing/object"
)

type tagsTable struct {
Expand Down Expand Up @@ -56,7 +57,7 @@ func (tagsTable) Children() []sql.Node {
}

type tagIter struct {
i *git.TagIter
i *object.TagIter
}

func (i *tagIter) Next() (sql.Row, error) {
Expand All @@ -68,7 +69,7 @@ func (i *tagIter) Next() (sql.Row, error) {
return tagToRow(tag), nil
}

func tagToRow(c *git.Tag) sql.Row {
func tagToRow(c *object.Tag) sql.Row {
return sql.NewMemoryRow(
c.Hash.String(),
c.Name,
Expand Down
7 changes: 4 additions & 3 deletions git/tree_entries.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"github.com/gitql/gitql/sql"

"gopkg.in/src-d/go-git.v4"
"gopkg.in/src-d/go-git.v4/plumbing/object"
)

type treeEntriesTable struct {
Expand Down Expand Up @@ -55,8 +56,8 @@ func (treeEntriesTable) Children() []sql.Node {
}

type treeEntryIter struct {
i *git.TreeIter
t *git.Tree
i *object.TreeIter
t *object.Tree
ei int
}

Expand Down Expand Up @@ -84,7 +85,7 @@ func (i *treeEntryIter) Next() (sql.Row, error) {
}
}

func treeEntryToRow(t *git.Tree, e git.TreeEntry) sql.Row {
func treeEntryToRow(t *object.Tree, e object.TreeEntry) sql.Row {
return sql.NewMemoryRow(
t.ID().String(),
e.Hash.String(),
Expand Down
2 changes: 1 addition & 1 deletion sql/parse/parse.go
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ func tableExprToTable(te sqlparser.TableExpr) (sql.Node, error) {
return nil, errUnsupportedFeature("non simple tables")
}

return plan.NewUnresolvedTable(string(tn.Name)), nil
return plan.NewUnresolvedTable(tn.Name.String()), nil
}
}

Expand Down

0 comments on commit c8b923f

Please sign in to comment.