-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Metadata tables #17
base: master
Are you sure you want to change the base?
Metadata tables #17
Conversation
Codecov Report
@@ Coverage Diff @@
## master #17 +/- ##
==========================================
- Coverage 53.3% 53.06% -0.25%
==========================================
Files 34 41 +7
Lines 1724 2039 +315
==========================================
+ Hits 919 1082 +163
- Misses 743 885 +142
- Partials 62 72 +10
Continue to review full report at Codecov.
|
66ceda6
to
e5f762a
Compare
engine_test.go
Outdated
@@ -110,7 +110,7 @@ func newEngine(t *testing.T) *sqle.Engine { | |||
db.AddTable("mytable", table) | |||
|
|||
e := sqle.New() | |||
e.AddDatabase(db) | |||
assert.Nil(e.AddDatabase(db)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
assert.NoError
if the return type is error
.
mem/database.go
Outdated
@@ -22,6 +22,6 @@ func (d *Database) Tables() map[string]sql.Table { | |||
return d.tables | |||
} | |||
|
|||
func (d *Database) AddTable(name string, t *Table) { | |||
d.tables[name] = t | |||
func (d *Database) AddTable(t sql.Table) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok. Makes sense. If we want to change the name of a table we could probably add a wrapper TableAlias
in the future.
mem/table.go
Outdated
@@ -4,13 +4,14 @@ import ( | |||
"fmt" | |||
"io" | |||
|
|||
"gopkg.in/sqle/sqle.v0/memory" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why there is mem
and memory
package?
memory/iterator.go
Outdated
data IteratorData | ||
} | ||
|
||
func NewIter(data IteratorData) *Iter { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's better to make this type private and expose only the RowIter interface.
sql/catalog.go
Outdated
Databases | ||
FunctionRegistry | ||
} | ||
|
||
type DBStorer interface { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rename to Catalog
68777a4
to
738af41
Compare
1ed786c
to
e15b2df
Compare
e15b2df
to
fa7b443
Compare
WIP notice
PR Description
I tried to follow these concept from mysql docs
If this PR is merged, it could be done the following:
Design:
The
metadata
–new– package, includes the implementation of the newINFORMATION_SCHEMA
database, that contains the three metadata tables:SCHEMATA
,TABLES
andCOLUMNS
, that embedsmem.Database
andmem.Table
respectively.The –new– three tables behaves like a view so they doesn't store data nor are writable.
Other changes, required by the main development:
sql.Engine::AddDatabase(db sql.Database) error
method,sql.Catalog
is now an Interface and operations over its handled databases should be done through its exposed methods:Database(name string) (Database, error)
AddDatabase(db Database) error
Dbs() Databases
Table(dbName string, tableName string) (Table, error)
sql.Database::Table(string) (Table, error)
method instead of accessing the database tables directly,mem.NewCIDatabase(name string)
constructor will build amem/Database
that will store the tables in a case insensitive way,mem.Table
embeds a newmem.underlayingData
that handles the storage, row iteration...,sql.Node
implementsfmt.Stringer
in order to be debugging friendly,DBIterator
, iterates over thesql.Database
handled by the givensql.Catalog
,TableIterator
, iterates over thesql.Table
stored by the given, forsql.Database
,ColumnIterator
, iterates over thesql.Column
defined by thesql.Schema
of the passedsql.Table
,