Skip to content

Commit

Permalink
Rft: remove defaultRegistry
Browse files Browse the repository at this point in the history
Users should make the decision that if use "global regitry". If they want, they should define their own global registry.
  • Loading branch information
flycash committed Oct 27, 2021
1 parent 3373867 commit 2d407fd
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 43 deletions.
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

0 comments on commit 2d407fd

Please sign in to comment.