Documentation
¶
Index ¶
- Constants
- func RegisterFilterOperator(o *filters.Operator)
- func StringDecoderValue(dctx bsoncodec.DecodeContext, vr bsonrw.ValueReader, val reflect.Value) error
- type Config
- type Factory
- type Repository
- func (r *Repository) Begin(ctx context.Context, s *query.Scope) error
- func (r *Repository) Close(ctx context.Context) error
- func (r *Repository) Commit(ctx context.Context, s *query.Scope) error
- func (r *Repository) Create(ctx context.Context, s *query.Scope) error
- func (r *Repository) CreateMany(ctx context.Context, s *query.Scope) error
- func (r *Repository) Delete(ctx context.Context, s *query.Scope) error
- func (r *Repository) Get(ctx context.Context, s *query.Scope) error
- func (r *Repository) List(ctx context.Context, s *query.Scope) error
- func (r *Repository) Patch(ctx context.Context, s *query.Scope) error
- func (r *Repository) RepositoryName() string
- func (r *Repository) Rollback(ctx context.Context, s *query.Scope) error
Constants ¶
const ( ReplicaSetHostsKey = "replica_set_hosts" ApplicationNameKey = "application_name" )
config.Repository.Options keys constants
Variables ¶
This section is empty.
Functions ¶
func RegisterFilterOperator ¶
RegisterFilterOperator registers operator with the BSONizer function
func StringDecoderValue ¶
func StringDecoderValue(dctx bsoncodec.DecodeContext, vr bsonrw.ValueReader, val reflect.Value) error
StringDecoderValue is the value decoder for the string fields
Types ¶
type Config ¶
type Config struct {
*config.Repository
// Hosts are the replica set hosts
Hosts []string
// ReplicaSetName is the name of the replica set
ReplicaSetName string
// ApplicationName is the name used in the mongodb logs for the specific client
ApplicationName string
// Options are the client options
Options *options.ClientOptions
// contains filtered or unexported fields
}
Config is the mongo db repository configuration struct
func NewConfig ¶
func NewConfig(cfgRepo *config.Repository) (*Config, error)
NewConfig creates new repository config
func (*Config) Connection ¶
Connection creates new mongo client connection
type Factory ¶
type Factory struct {
// contains filtered or unexported fields
}
Factory is the MongoDB - neuron repository factory
func (*Factory) New ¶
func (f *Factory) New(c repository.ModelStructer, m *mapping.ModelStruct) (repository.Repository, error)
New create new Mongo repository for the provided model struct
func (*Factory) RepositoryName ¶
RepositoryName gets the Factory repository names Implements repository.Repository interface
type Repository ¶
type Repository struct {
// Client is the mongodb connection client
Client *mongo.Client
// Config contains all the connection configurations
Config *Config
// contains filtered or unexported fields
}
Repository is the MongoDB - Neuron repository
func (*Repository) Begin ¶
Begin uses the mongo repository to create the query scope value Implements query.Beginer interface
func (*Repository) Close ¶
func (r *Repository) Close(ctx context.Context) error
Close closes the repository active connections
func (*Repository) Commit ¶
Commit uses the mongo repository to create the query scope value Implements query.Commiter interface
func (*Repository) Create ¶
Create uses the mongo repository to create the query scope value Implements query.Creater interface
func (*Repository) CreateMany ¶
CreateMany inserts multiple instances of given scope values Implements query.ManyCreater interface
func (*Repository) Delete ¶
Delete uses the mongo repository to create the query scope value Implements query.Deleter interface
func (*Repository) Get ¶
Get uses the mongo repository to create the query scope value Implements query.Geter interface
func (*Repository) List ¶
List uses the mongo repository to create the query scope value Implements query.Lister interface
func (*Repository) Patch ¶
Patch uses the mongo repository to create the query scope value Implements query.Patcher interface
func (*Repository) RepositoryName ¶
func (r *Repository) RepositoryName() string
RepositoryName returns the repository name for the mongo repository Implements repository.Repository interface