Documentation ¶
Index ¶
- Variables
- func ErrDuplicateUniqueConstraint(cause error) error
- type Builder
- type MongoDB
- func (m *MongoDB) Aggregate(ctx context.Context, collectionName mongoModel.Collection, pipe mongo.Pipeline) (*mongo.Cursor, error)
- func (m *MongoDB) CollectionIndexes(ctx context.Context, collection mongoModel.Collection) (map[string]*mongoModel.DBIndex, error)
- func (m *MongoDB) Count(ctx context.Context, collectionName mongoModel.Collection, find interface{}, ...) (int64, error)
- func (m *MongoDB) CreateIndex(ctx context.Context, index *mongoModel.DBIndex) (string, error)
- func (m *MongoDB) CreateTextIndex(ctx context.Context, index *mongoModel.DBTextIndex) (string, error)
- func (m *MongoDB) DeleteMany(ctx context.Context, collectionName mongoModel.Collection, filter interface{}, ...) (*mongo.DeleteResult, error)
- func (m *MongoDB) DeleteOne(ctx context.Context, collectionName mongoModel.Collection, filter interface{}, ...) (*mongo.DeleteResult, error)
- func (m *MongoDB) Find(ctx context.Context, collectionName mongoModel.Collection, results interface{}, ...) error
- func (m *MongoDB) FindOne(ctx context.Context, collectionName mongoModel.Collection, ...) error
- func (m *MongoDB) FindOneAndUpdate(ctx context.Context, collectionName mongoModel.Collection, ...) error
- func (m *MongoDB) Insert(ctx context.Context, collectionName mongoModel.Collection, data interface{}) (string, error)
- func (m *MongoDB) InsertMany(ctx context.Context, collectionName mongoModel.Collection, data []interface{}) ([]string, error)
- func (m *MongoDB) ReplaceOne(ctx context.Context, collectionName mongoModel.Collection, filter interface{}, ...) error
- func (m *MongoDB) Start(ctx context.Context) error
- func (m *MongoDB) Stop(ctx context.Context) error
- func (m *MongoDB) TryCreateIndex(ctx context.Context, index *mongoModel.DBIndex) error
- func (m *MongoDB) UpdateMany(ctx context.Context, collectionName mongoModel.Collection, filter interface{}, ...) (int64, error)
- func (m *MongoDB) UpdateOne(ctx context.Context, collectionName mongoModel.Collection, ...) (int64, error)
- type Repository
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrLoggerIsRequired = errors.NewError("SYS", "Logger is required") ErrConfigIsRequired = errors.NewError("SYS", "Config is required") )
View Source
var (
DuplicateUniqueConstraintErrorCode = errors.ErrorCode("a15da443-001")
)
Functions ¶
Types ¶
type Builder ¶
type Builder struct {
// contains filtered or unexported fields
}
func NewBuilder ¶
func NewBuilder() *Builder
type MongoDB ¶
type MongoDB struct {
// contains filtered or unexported fields
}
func (*MongoDB) Aggregate ¶
func (m *MongoDB) Aggregate( ctx context.Context, collectionName mongoModel.Collection, pipe mongo.Pipeline, ) (*mongo.Cursor, error)
func (*MongoDB) CollectionIndexes ¶
func (m *MongoDB) CollectionIndexes(ctx context.Context, collection mongoModel.Collection) (map[string]*mongoModel.DBIndex, error)
func (*MongoDB) Count ¶
func (m *MongoDB) Count( ctx context.Context, collectionName mongoModel.Collection, find interface{}, opt *options.CountOptions, ) (int64, error)
func (*MongoDB) CreateIndex ¶
func (*MongoDB) CreateTextIndex ¶
func (m *MongoDB) CreateTextIndex(ctx context.Context, index *mongoModel.DBTextIndex) (string, error)
func (*MongoDB) DeleteMany ¶
func (m *MongoDB) DeleteMany( ctx context.Context, collectionName mongoModel.Collection, filter interface{}, opt *options.DeleteOptions, ) (*mongo.DeleteResult, error)
func (*MongoDB) DeleteOne ¶
func (m *MongoDB) DeleteOne( ctx context.Context, collectionName mongoModel.Collection, filter interface{}, opt *options.DeleteOptions, ) (*mongo.DeleteResult, error)
func (*MongoDB) Find ¶
func (m *MongoDB) Find( ctx context.Context, collectionName mongoModel.Collection, results interface{}, find interface{}, opt *options.FindOptions, ) error
func (*MongoDB) FindOne ¶
func (m *MongoDB) FindOne( ctx context.Context, collectionName mongoModel.Collection, resultModel, findQuery interface{}, findOptions *options.FindOneOptions, ) error
func (*MongoDB) FindOneAndUpdate ¶
func (m *MongoDB) FindOneAndUpdate( ctx context.Context, collectionName mongoModel.Collection, resultModel, filter, updateData interface{}, opt *options.FindOneAndUpdateOptions, ) error
func (*MongoDB) Insert ¶
func (m *MongoDB) Insert(ctx context.Context, collectionName mongoModel.Collection, data interface{}) (string, error)
func (*MongoDB) InsertMany ¶
func (m *MongoDB) InsertMany(ctx context.Context, collectionName mongoModel.Collection, data []interface{}) ([]string, error)
func (*MongoDB) ReplaceOne ¶
func (m *MongoDB) ReplaceOne( ctx context.Context, collectionName mongoModel.Collection, filter interface{}, data interface{}, ) error
func (*MongoDB) TryCreateIndex ¶
func (*MongoDB) UpdateMany ¶
func (m *MongoDB) UpdateMany( ctx context.Context, collectionName mongoModel.Collection, filter interface{}, data interface{}, opts ...*options.UpdateOptions, ) (int64, error)
func (*MongoDB) UpdateOne ¶
func (m *MongoDB) UpdateOne( ctx context.Context, collectionName mongoModel.Collection, filter, data interface{}, opts ...*options.UpdateOptions, ) (int64, error)
type Repository ¶
type Repository interface { Insert(ctx context.Context, collection mongoModel.Collection, data interface{}) (string, error) InsertMany(ctx context.Context, collection mongoModel.Collection, data []interface{}) ([]string, error) FindOneAndUpdate( ctx context.Context, collection mongoModel.Collection, resultModel, filter, updateData interface{}, opt *options.FindOneAndUpdateOptions, ) error ReplaceOne(ctx context.Context, collection mongoModel.Collection, filter, data interface{}) error UpdateOne( ctx context.Context, collection mongoModel.Collection, filter, data interface{}, opts ...*options.UpdateOptions, ) (int64, error) UpdateMany( ctx context.Context, collection mongoModel.Collection, filter interface{}, data interface{}, opts ...*options.UpdateOptions, ) (int64, error) Find(ctx context.Context, collection mongoModel.Collection, results, find interface{}, opt *options.FindOptions) error FindOne( ctx context.Context, collection mongoModel.Collection, resultModel, findQuery interface{}, findOptions *options.FindOneOptions, ) error DeleteOne(ctx context.Context, collection mongoModel.Collection, filter interface{}, opt *options.DeleteOptions, ) (*mongo.DeleteResult, error) DeleteMany(ctx context.Context, collection mongoModel.Collection, filter interface{}, opt *options.DeleteOptions, ) (*mongo.DeleteResult, error) Count(ctx context.Context, collection mongoModel.Collection, find interface{}, opt *options.CountOptions) (int64, error) Aggregate(ctx context.Context, collection mongoModel.Collection, pipe mongo.Pipeline) (*mongo.Cursor, error) CreateTextIndex(ctx context.Context, index *mongoModel.DBTextIndex) (string, error) CreateIndex(ctx context.Context, index *mongoModel.DBIndex) (string, error) TryCreateIndex(ctx context.Context, index *mongoModel.DBIndex) error CollectionIndexes(ctx context.Context, collection mongoModel.Collection) (map[string]*mongoModel.DBIndex, error) }
Click to show internal directories.
Click to hide internal directories.