Documentation ¶
Index ¶
- Constants
- func RegisterFilterOperator(o *filters.Operator)
- func StringDecoderValue(dctx bsoncodec.DecodeContext, vr bsonrw.ValueReader, val reflect.Value) (err 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) Count(ctx context.Context, s *query.Scope) (int64, 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) FactoryName() string
- 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) Rollback(ctx context.Context, s *query.Scope) error
Constants ¶
const ( ReplicaSetHostsKey = "replica_set_hosts" ApplicationNameKey = "application_name" )
config.Repository.Options keys constants
const DirectConnectOption = "connect-direct"
DirectConnectOption is the option to set direct connect.
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) (err 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 // Direct sets direct connection. Direct bool // 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) DriverName ¶ added in v0.2.2
DriverName implements repository.Repository interface.
func (*Factory) New ¶
func (f *Factory) New(c repository.Controller, m *mapping.ModelStruct) (repository.Repository, error)
New create new Mongo repository for the provided ModelStruct.
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.Repository.
func (*Repository) Close ¶
func (r *Repository) Close(ctx context.Context) error
Close closes the repository active connections.
func (*Repository) Create ¶
Create uses the mongo repository to create the query scope value. Implements query.Creator interface.
func (*Repository) CreateMany ¶
CreateMany inserts multiple instances of given scope values Implements query.ManyCreator interface
func (*Repository) Delete ¶
Delete uses the mongo repository to create the query scope value. Implements query.Deleter interface.
func (*Repository) FactoryName ¶ added in v0.6.1
func (r *Repository) FactoryName() string
FactoryName implements repository.Repository interface.
func (*Repository) Get ¶
Get uses the mongo repository to get the query scope value from the mongo database. Implements query.Getter interface.
func (*Repository) List ¶
List uses the mongo repository to create the query scope value. Implements query.Lister interface.