Skip to content

Instantly share code, notes, and snippets.

@nkreiger
Created December 28, 2020 19:20
Show Gist options
  • Save nkreiger/9315518677aa21e9976838203ad905e3 to your computer and use it in GitHub Desktop.
Save nkreiger/9315518677aa21e9976838203ad905e3 to your computer and use it in GitHub Desktop.
package mongo
import (
"context"
mgo "go.mongodb.org/mongo-driver/mongo"
)
// ExecuteParams defines the necessary values to execute a
// mongo query
type ExecuteParams struct {
Context context.Context
Database *mgo.Database
Collection string
}
// QueryInputs handles the inputs that would go into a basic and advanced MQL
type QueryInputs struct {
Limit int64 `json:"limit"`
Projection []string `json:"projection"`
Sort BasicParams `json:"sort"`
Params BasicParams `json:"params"`
Update map[string]BasicParams `json:"update"`
ParamsWithOperations map[string][]BasicParams `json:"paramsWithOperations"`
}
// BasicParams is a subset of query inputs
type BasicParams map[string]interface{}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment