Documentation ¶
Index ¶
- type MongoConnectDetails
- func (mongoConnectDetails *MongoConnectDetails) Connect(requestContext context.Context) error
- func (mongoConnectDetails *MongoConnectDetails) CreateDocument(requestContext context.Context, document interface{}) (interface{}, error)
- func (mongoConnectDetails *MongoConnectDetails) CreateIndex(requestContext context.Context, field string, opts ...string) error
- func (mongoConnectDetails *MongoConnectDetails) DeleteDocument(requestContext context.Context, field string, id string) (int, error)
- func (mongoConnectDetails *MongoConnectDetails) Disconnect() error
- func (mongoConnectDetails *MongoConnectDetails) GetDocumentByID(requestContext context.Context, field string, id string) (interface{}, error)
- func (mongoConnectDetails *MongoConnectDetails) InsertManyDocuments(requestContext context.Context, documents []interface{}) (int, error)
- func (mongoConnectDetails *MongoConnectDetails) ListDatabases(requestContext context.Context) ([]string, error)
- func (mongoConnectDetails *MongoConnectDetails) SearchDocumentsByField(requestContext context.Context, field string, term string) ([]interface{}, error)
- func (mongoConnectDetails *MongoConnectDetails) SelectCollection(dbName string, collectionName string)
- func (mongoConnectDetails *MongoConnectDetails) UpdateDocumentByID(requestContext context.Context, field string, id string, update interface{}) (int, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type MongoConnectDetails ¶
type MongoConnectDetails struct { Username string `json:"username"` Password string `json:"password"` Host string `json:"host"` Port int `json:"port"` AuthSource string `json:"authSource"` App string `json:"app"` // contains filtered or unexported fields }
MongoConnectDetails model
func (*MongoConnectDetails) Connect ¶
func (mongoConnectDetails *MongoConnectDetails) Connect(requestContext context.Context) error
Connect function to mongo that accepts MongoConnectDetails struct
func (*MongoConnectDetails) CreateDocument ¶
func (mongoConnectDetails *MongoConnectDetails) CreateDocument(requestContext context.Context, document interface{}) (interface{}, error)
CreateDocument
func (*MongoConnectDetails) CreateIndex ¶
func (mongoConnectDetails *MongoConnectDetails) CreateIndex(requestContext context.Context, field string, opts ...string) error
CreateIndex expects a single field and optionall a desired sort order ("asc" or "desc") for nested fields, pass a string that traverses fields using "."
func (*MongoConnectDetails) DeleteDocument ¶
func (mongoConnectDetails *MongoConnectDetails) DeleteDocument(requestContext context.Context, field string, id string) (int, error)
DeleteDocument expects request context in addition to specifying the field and identifier for the target document to delete
func (*MongoConnectDetails) Disconnect ¶
func (mongoConnectDetails *MongoConnectDetails) Disconnect() error
func (*MongoConnectDetails) GetDocumentByID ¶
func (mongoConnectDetails *MongoConnectDetails) GetDocumentByID(requestContext context.Context, field string, id string) (interface{}, error)
GetDocument will retrieve a single document by provided "id" field returned interface{} value can be Marshalled and Unmarshalled as needed
func (*MongoConnectDetails) InsertManyDocuments ¶
func (mongoConnectDetails *MongoConnectDetails) InsertManyDocuments(requestContext context.Context, documents []interface{}) (int, error)
func (*MongoConnectDetails) ListDatabases ¶
func (mongoConnectDetails *MongoConnectDetails) ListDatabases(requestContext context.Context) ([]string, error)
ListDatabases returns database list
func (*MongoConnectDetails) SearchDocumentsByField ¶
func (mongoConnectDetails *MongoConnectDetails) SearchDocumentsByField(requestContext context.Context, field string, term string) ([]interface{}, error)
SearchDocument expects request context and relies on a field name and single term string to find documents
func (*MongoConnectDetails) SelectCollection ¶
func (mongoConnectDetails *MongoConnectDetails) SelectCollection(dbName string, collectionName string)