Documentation ¶
Index ¶
- type Connections
- func (conn *Connections) Connect()
- func (conn *Connections) CreateConnection()
- func (conn *Connections) DeleteInterface()
- func (conn *Connections) DeleteRecord(filter bson.M) int64
- func (conn *Connections) GetClient() *mongo.Client
- func (conn *Connections) InsertInterface()
- func (conn *Connections) InsertRecord(product Product) interface{}
- func (conn *Connections) ReturnAllRecords(filter bson.M) []*Product
- func (conn *Connections) ReturnRecordInterface()
- func (conn *Connections) UpdateInterface()
- func (conn *Connections) UpdateRecord(updatedData interface{}, where bson.M) int64
- type Product
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Connections ¶
type Connections struct {
// contains filtered or unexported fields
}
Connections is a MongoDB Connection handler
func NewConnection ¶
func NewConnection(l *log.Logger) *Connections
NewConnection creates a connection with the given logger
func (*Connections) Connect ¶
func (conn *Connections) Connect()
Connect creates and checks connection
func (*Connections) CreateConnection ¶
func (conn *Connections) CreateConnection()
CreateConnection gets GetClient, checks connection and returns connection for CRUD Interface.
func (*Connections) DeleteInterface ¶
func (conn *Connections) DeleteInterface()
DeleteInterface is Temp Func for later implementation
func (*Connections) DeleteRecord ¶
func (conn *Connections) DeleteRecord(filter bson.M) int64
DeleteRecord remove one existing Record Returns no. of Record/Document deleted.
func (*Connections) GetClient ¶
func (conn *Connections) GetClient() *mongo.Client
GetClient returns a MongoDB Client
func (*Connections) InsertInterface ¶
func (conn *Connections) InsertInterface()
InsertInterface is Temp Func for later implementation
func (*Connections) InsertRecord ¶
func (conn *Connections) InsertRecord(product Product) interface{}
InsertRecord insert a new record in the Collection Returns ObjectID of each Document/Record inserted.
func (*Connections) ReturnAllRecords ¶
func (conn *Connections) ReturnAllRecords(filter bson.M) []*Product
ReturnAllRecords return all documents from the collection Products
func (*Connections) ReturnRecordInterface ¶
func (conn *Connections) ReturnRecordInterface()
ReturnRecordInterface is Temp Func for later implementation
func (*Connections) UpdateInterface ¶
func (conn *Connections) UpdateInterface()
UpdateInterface is Temp Func for later implementation
func (*Connections) UpdateRecord ¶
func (conn *Connections) UpdateRecord(updatedData interface{}, where bson.M) int64
UpdateRecord updates the value of a record Returns no. of record updated as Int .
type Product ¶
type Product struct { Fileid int `json:"fileid" bson:"fileid"` Position int `json:"position" bson:"position"` Filename string `json:"filename" bson:"filename"` Description string `json:"description" bson:"description"` Filedate string `json:"filedate" bson:"filedate"` Source string `json:"source" bson:"source"` }
Product defines the structure for an API product