Documentation
¶
Index ¶
- Constants
- func BatchBulkCreate(BulkCreate func(*[]bson.M) error, documents *[]bson.M, limit int) error
- func ConnectDB(mongoUrl string) (*mongo.Client, error)
- func NewMongoQueryContext() (context.Context, context.CancelFunc)
- type Repository
- func (r *Repository) Aggregate(documents interface{}, pipelineOptions mongo.Pipeline) error
- func (r *Repository) BulkCreate(documents *[]bson.M) error
- func (r *Repository) BulkDelete(filter bson.M) error
- func (r *Repository) BulkUpdate(filter bson.M, update bson.M) error
- func (r *Repository) BulkUpsert(documents []bson.M) error
- func (r *Repository) DeleteByID(id string) error
- func (r *Repository) FindAll(documents interface{}, filter interface{}, opts *options.FindOptions) error
- func (r *Repository) FindOne(document interface{}, filter interface{}, opts *options.FindOneOptions) error
- func (r *Repository) InsertOne(document interface{}) error
- func (r *Repository) UpdateOne(filter interface{}, update interface{}) error
Constants ¶
View Source
const ( ASSETS_COLLECTION = "assets" EVENT_LOGS_COLLECTION = "eventlogs" NOTIFICATIONS_COLLECTION = "notifications" ACCOUNTS_COLLECTION = "accounts" BENCHMARKS_COLLECTION = "benchmarks" ASSETS_PRICES_COLLECTION = "assetsprices" APPLICATION_EXECUTION_STATES_COLLECTION = "applicationExecutionStates" APPLICATIONS_COLLECTION = "applications" DCA_JOBS_COLLECTION = "dcaJobs" DCA_ASSETS_COLLECTION = "dcaAssets" )
Variables ¶
This section is empty.
Functions ¶
func BatchBulkCreate ¶
func NewMongoQueryContext ¶
func NewMongoQueryContext() (context.Context, context.CancelFunc)
Types ¶
type Repository ¶
type Repository struct {
// contains filtered or unexported fields
}
Repository is a generic mongo service to used by other repositories
func NewRepository ¶
func NewRepository(c *mongo.Collection) *Repository
NewRepository returns an instance of Repository
func (*Repository) Aggregate ¶
func (r *Repository) Aggregate(documents interface{}, pipelineOptions mongo.Pipeline) error
Aggregate returns rows aggregated
func (*Repository) BulkCreate ¶
func (r *Repository) BulkCreate(documents *[]bson.M) error
BulkCreate creates multiple documents
func (*Repository) BulkDelete ¶
func (r *Repository) BulkDelete(filter bson.M) error
BulkDelete deletes multiple documents
func (*Repository) BulkUpdate ¶
BulkUpdate updates multiple documents
func (*Repository) BulkUpsert ¶
func (r *Repository) BulkUpsert(documents []bson.M) error
BulkUpsert creates multiple documents if there are no documents with the same data
func (*Repository) DeleteByID ¶
func (r *Repository) DeleteByID(id string) error
DeleteByID delete one document by ID
func (*Repository) FindAll ¶
func (r *Repository) FindAll(documents interface{}, filter interface{}, opts *options.FindOptions) error
FindAll returns rows that match criteria
func (*Repository) FindOne ¶
func (r *Repository) FindOne(document interface{}, filter interface{}, opts *options.FindOneOptions) error
FindOne returns one row that match criteria
func (*Repository) InsertOne ¶
func (r *Repository) InsertOne(document interface{}) error
InsertOne creates one document
func (*Repository) UpdateOne ¶
func (r *Repository) UpdateOne(filter interface{}, update interface{}) error
UpdateOne updates one document found with match criteria
Click to show internal directories.
Click to hide internal directories.