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

Rft: remove defaultRegistry #46

Merged
merged 1 commit into from
Oct 28, 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,6 +5,7 @@
- [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)
- [Rft: remove defaultRegistry](https://github.com/gotomicro/eql/pull/46)
- [Use `bytebufferpool` for builder](https://github.com/gotomicro/eql/pull/39)
- [Refactor: move Insert function into db.file](https://github.com/gotomicro/eql/pull/28)
- [Selector implementation, excluding WHERE and HAVING clauses](https://github.com/gotomicro/eql/pull/32)
Expand Down
2 changes: 1 addition & 1 deletion db.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ type DB struct {
// New returns DB. It's the entry of EQL
func New(opts ...DBOption) *DB {
db := &DB{
metaRegistry: defaultMetaRegistry,
metaRegistry: &tagMetaRegistry{},
dialect: mysql,
nullAssertFunc: NilAsNullFunc,
}
Expand Down
38 changes: 0 additions & 38 deletions global.go

This file was deleted.

1 change: 1 addition & 0 deletions internal/common_fun.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package internal

import (
Expand Down
4 changes: 1 addition & 3 deletions model.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,12 @@ type ColumnMeta struct {

type tableMetaOption func(meta *TableMeta)

// MetadaRegistry stores table metadata
// MetaRegistry stores table metadata
type MetaRegistry interface {
Get(table interface{}) (*TableMeta, error)
Register(table interface{}, opts ...tableMetaOption) (*TableMeta, error)
}

var defaultMetaRegistry = &tagMetaRegistry{}

// tagMetaRegistry is the default implementation based on tag eql
type tagMetaRegistry struct {
metas sync.Map
Expand Down
3 changes: 2 additions & 1 deletion model_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ import (

func TestTagMetaRegistry(t *testing.T) {
tm := &TestModel{}
meta, err := defaultMetaRegistry.Register(tm)
registry := &tagMetaRegistry{}
meta, err := registry.Register(tm)
if err != nil {
t.Fatal(err)
}
Expand Down