Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrNoDocuments = errors.New("no documents in result")
Functions ¶
This section is empty.
Types ¶
type ArrayFilters ¶
type ArrayFilters struct {
Filters []interface{} // The filters to apply
}
type BulkUpdateOne ¶
type BulkUpdateOne struct { Filter interface{} Data interface{} }
type IncrementOperator ¶
type IncrementOperator struct {
Inc interface{} `json:"$inc" bson:"$inc"`
}
type QueryResult ¶
type QuerySingleResult ¶
type Repository ¶
type Repository interface { Save(collectionName string, data interface{}) <-chan RepositoryResult SaveMany(collectionName string, data []interface{}) <-chan RepositoryResult Aggregate(collectionName string, pipeline interface{}) <-chan QueryResult Find(collectionName string, filter interface{}, limit int64, skip int64, sort map[string]int) <-chan QueryResult FindOne(collectionName string, filter interface{}) <-chan QuerySingleResult Update(collectionName string, filter interface{}, data interface{}, opts ...*UpdateOptions) <-chan RepositoryResult UpdateMany(collectionName string, filter interface{}, data interface{}, opts ...*UpdateOptions) <-chan RepositoryResult BulkUpdateOne(collectionName string, bulkData []BulkUpdateOne) <-chan RepositoryResult Delete(collectionName string, filter interface{}, justOne bool) <-chan RepositoryResult CreateIndex(collectionName string, indexes map[string]interface{}) <-chan error }
type RepositoryResult ¶
type RepositoryResult struct { Error error Result interface{} }
RepositoryResult is a struct to wrap repository result so its easy to use it in channel
type SearchOperator ¶
type SearchOperator struct {
Search string `json:"$search" bson:"$search"`
}
type TextOperator ¶
type TextOperator struct {
Text SearchOperator `json:"$text" bson:"$text"`
}
type UpdateOperator ¶
type UpdateOperator struct {
Set interface{} `json:"$set" bson:"$set"`
}
type UpdateOptions ¶
type UpdateOptions struct { ArrayFilters *ArrayFilters // A set of filters specifying to which array elements an update should apply BypassDocumentValidation *bool // If true, allows the write to opt-out of document level validation Upsert *bool // When true, creates a new document if no document matches the query }
UpdateOptions
func MergeUpdateOptions ¶
func MergeUpdateOptions(opts ...*UpdateOptions) *UpdateOptions
MergeUpdateOptions combines the argued UpdateOptions into a single UpdateOptions in a last-one-wins fashion
func (*UpdateOptions) SetArrayFilters ¶
func (uo *UpdateOptions) SetArrayFilters(af ArrayFilters) *UpdateOptions
SetArrayFilters specifies a set of filters specifying to which array elements an update should apply
func (*UpdateOptions) SetBypassDocumentValidation ¶
func (uo *UpdateOptions) SetBypassDocumentValidation(b bool) *UpdateOptions
SetBypassDocumentValidation allows the write to opt-out of document level validation.
func (*UpdateOptions) SetUpsert ¶
func (uo *UpdateOptions) SetUpsert(b bool) *UpdateOptions
SetUpsert allows the creation of a new document if not document matches the query
Click to show internal directories.
Click to hide internal directories.