Documentation ¶
Overview ¶
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Index ¶
- Constants
- func BuildLookupStage(populate PopulateOptions) []bson.D
- func BuildQueries(p PaginationFindParams) (queries []bson.M, sort bson.D, err error)
- func Connect(params ConnectionParams)
- func Disconnect() error
- func GenerateCursorQuery(shouldSecondarySortOnID bool, paginatedField string, comparisonOp string, ...) (map[string]interface{}, error)
- func GetCollection(collectionName string) *mongo.Collection
- func ToObjectID(hex string) primitive.ObjectID
- type ConnectionParams
- type CursorError
- type Model
- func (mf *Model) Aggregate(pipeline mongo.Pipeline, results interface{}) error
- func (mf *Model) CountDocuments(filter bson.M) (int, error)
- func (mf *Model) Find(filter bson.M, results interface{}) error
- func (mf *Model) FindAndPopulate(filter bson.M, option options.FindOptions, populate []PopulateOptions, ...) error
- func (mf *Model) FindByID(id string, result interface{}) (err error)
- func (mf *Model) FindByObjectID(objectID primitive.ObjectID, result interface{}) (err error)
- func (mf *Model) FindOne(filter bson.M, result interface{}) (err error)
- func (mf *Model) FindOneAndPopulate(filter bson.M, findOptions options.FindOptions, populate []PopulateOptions, ...) error
- func (mf *Model) FindWithOptions(filter bson.M, option options.FindOptions, results interface{}) error
- func (mf *Model) InsertMany(records []interface{}) (res *mongo.InsertManyResult, err error)
- func (mf *Model) InsertOne(record interface{}) (res *mongo.InsertOneResult, err error)
- func (mf *Model) PaginatedFind(params PaginationFindParams, results interface{}) (Page, error)
- type Mongo
- type Page
- type PaginationFindParams
- type PopulateOptions
Constants ¶
Variables ¶
This section is empty.
Functions ¶
func BuildLookupStage ¶ added in v0.0.8
func BuildLookupStage(populate PopulateOptions) []bson.D
func BuildQueries ¶
func Disconnect ¶ added in v0.0.5
func Disconnect() error
func GenerateCursorQuery ¶
func GetCollection ¶
func GetCollection(collectionName string) *mongo.Collection
func ToObjectID ¶
Types ¶
type ConnectionParams ¶
type CursorError ¶
type CursorError struct {
// contains filtered or unexported fields
}
func (*CursorError) Error ¶
func (e *CursorError) Error() string
type Model ¶ added in v0.0.4
type Model struct {
// contains filtered or unexported fields
}
func (*Model) CountDocuments ¶ added in v0.0.4
func (*Model) FindAndPopulate ¶ added in v0.0.4
func (mf *Model) FindAndPopulate(filter bson.M, option options.FindOptions, populate []PopulateOptions, results interface{}) error
func (*Model) FindByObjectID ¶ added in v0.0.4
func (*Model) FindOneAndPopulate ¶ added in v0.0.4
func (mf *Model) FindOneAndPopulate(filter bson.M, findOptions options.FindOptions, populate []PopulateOptions, result interface{}) error
func (*Model) FindWithOptions ¶ added in v0.0.4
func (*Model) InsertMany ¶ added in v0.0.4
func (mf *Model) InsertMany(records []interface{}) (res *mongo.InsertManyResult, err error)
func (*Model) InsertOne ¶ added in v0.0.4
func (mf *Model) InsertOne(record interface{}) (res *mongo.InsertOneResult, err error)
func (*Model) PaginatedFind ¶ added in v0.0.4
func (mf *Model) PaginatedFind(params PaginationFindParams, results interface{}) (Page, error)
type PaginationFindParams ¶
type PaginationFindParams struct { Query primitive.M `form:"query"` Limit int64 `form:"limit" binding:"required"` SortAscending bool `form:"sort_ascending"` PaginatedField string `form:"paginated_field"` Collation *options.Collation `form:"collation"` Next string `form:"next"` Previous string `form:"previous"` CountTotal bool `form:"count_total"` Hint interface{} `form:"hint"` Projection string `form:"projection"` Expansion []PopulateOptions }
Click to show internal directories.
Click to hide internal directories.