# README
Databases Golang
This repository will have connectors for most popular databases
How to use
All instance it is singleton, you can multiple use them in another file, without any worries about connections counts
go get github.com/PxyUp/go-databases
import (
"github.com/PxyUp/go-databases"
)
func main() {
instance := go_databases.GetMongoConnector()
err := instance.Connect(mongoString, mongoDbName)
assert.Equal(t, err, nil)
user := &user{
"Test",
}
err = instance.InsertOne(collection, user)
assert.Equal(t, err, nil)
}
Mongo
type MongoDbConnector interface {
Connect(mongoUrl string, databaseName string) error
Disconnect()
InsertOne(collectionName string, entity interface{}) error
UpdateOne(collectionName string, findPredicate bson.M, updatePredicate bson.M) error
UpdateAll(collectionName string, findPredicate bson.M, updatePredicate bson.M) (*mgo.ChangeInfo, error)
GetOne(collectionName string, findPredicate bson.M, structToDeserialize interface{}) error
GetAll(collectionName string, findPredicate bson.M, structToDeserialize interface{}) error
GetOneProject(collectionName string, findPredicate bson.M, projectFields bson.M, structToDeserialize interface{}) error
GetAllProject(collectionName string, findPredicate bson.M, projectFields bson.M, structToDeserialize interface{}) error
}
# Packages
No description provided by the author
# Functions
No description provided by the author
# Constants
No description provided by the author
# Interfaces
No description provided by the author
# Type aliases
No description provided by the author