diff --git a/model/model.go b/model/model.go index a6edbe9e..8f33912d 100644 --- a/model/model.go +++ b/model/model.go @@ -1,12 +1,6 @@ // Package model is an interface for data modelling package model -import ( - "github.com/unistack-org/micro/v3/codec" - "github.com/unistack-org/micro/v3/store" - "github.com/unistack-org/micro/v3/sync" -) - // Model provides an interface for data modelling type Model interface { // Initialise options @@ -37,24 +31,3 @@ type Entity interface { // Read a value as a concrete type Read(v interface{}) error } - -type Options struct { - // Database to write to - Database string - // for serialising - Codec codec.Marshaler - // for locking - Sync sync.Sync - // for storage - Store store.Store -} - -type Option func(o *Options) - -type ReadOptions struct{} - -type ReadOption func(o *ReadOptions) - -type DeleteOptions struct{} - -type DeleteOption func(o *DeleteOptions) diff --git a/model/options.go b/model/options.go new file mode 100644 index 00000000..6e1284eb --- /dev/null +++ b/model/options.go @@ -0,0 +1,39 @@ +// Package model is an interface for data modelling +package model + +import ( + "github.com/unistack-org/micro/v3/codec" + "github.com/unistack-org/micro/v3/logger" + "github.com/unistack-org/micro/v3/store" + "github.com/unistack-org/micro/v3/sync" +) + +type Options struct { + // Database to write to + Database string + // for serialising + Codec codec.Marshaler + // for locking + Sync sync.Sync + // for storage + Store store.Store + // for logger + Logger logger.Logger +} + +type Option func(o *Options) + +// Logger sets the logger +func Logger(l logger.Logger) Option { + return func(o *Options) { + o.Logger = l + } +} + +type ReadOptions struct{} + +type ReadOption func(o *ReadOptions) + +type DeleteOptions struct{} + +type DeleteOption func(o *DeleteOptions)