Skip to content
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

Refactor: move Insert function into db.file #28

Merged
merged 1 commit into from
Sep 26, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@
- [Updater Definition](https://github.com/gotomicro/eql/pull/8)
- [Metadata API](https://github.com/gotomicro/eql/pull/16)
- [tagMetaRegistry: default implementation of MetaRegistry](https://github.com/gotomicro/eql/pull/25)
- [Refactor: move Insert function into db.file](https://github.com/gotomicro/eql/pull/28)
9 changes: 7 additions & 2 deletions db.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,14 @@ type DB struct {
}

// New returns DB. It's the entry of EQL
func New(opts...DBOption) *DB {
func New(opts ...DBOption) *DB {
return &DB{
metaRegistry: defaultMetaRegistry,
}
}

// Select starts a select query. If columns are empty, all columns will be fetched
func (*DB) Select(columns...Selectable) *Selector {
func (*DB) Select(columns ...Selectable) *Selector {
panic("implement me")
}

Expand All @@ -42,3 +42,8 @@ func (*DB) Delete() *Deleter {
func (*DB) Update(table interface{}) *Updater {
panic("implement me")
}

// Insert generate Inserter to builder insert query
func (db *DB) Insert() *Inserter {
return &Inserter{}
}
11 changes: 2 additions & 9 deletions insert.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,27 +16,21 @@ package eql

// Inserter is used to construct an insert query
type Inserter struct {

}

func (i *Inserter) Build() (*Query, error) {
panic("implement me")
}

// Insert generate Inserter to builder insert query
func (db *DB) Insert() *Inserter {
return &Inserter{}
}

// Columns specifies the columns that need to be inserted
// if cs is empty, all columns will be inserted except auto increment columns
func (db *DB) Columns(cs...string) *Inserter {
func (db *DB) Columns(cs ...string) *Inserter {
panic("implements me")
}

// Values specify the rows
// all the elements must be the same structure
func (i *Inserter) Values(values...interface{}) *Inserter {
func (i *Inserter) Values(values ...interface{}) *Inserter {
panic("implement me")
}

Expand All @@ -51,4 +45,3 @@ func (i *Inserter) OnDuplicateKey() *MysqlUpserter {
func (i *Inserter) OnConflict(cs ...string) *PgSQLUpserter {
panic("implement me")
}