Documentation ¶
Index ¶
- Variables
- func Close(resourceName string)
- func GenerateDSN(resource *Resource, includeDb bool) string
- func GenerateURI(option *Resource, db bool) string
- func MgoParseURI(url string, rootCAs *x509.CertPool) (*mgo.DialInfo, error)
- type ConnectionBuffers
- type Connections
- type DBResources
- type Map
- type Resource
- type SqlConnectionBuffers
- type SqlConnections
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrNotFound variable ErrNotFound = mgo.ErrNotFound // ErrCursor variable ErrCursor = mgo.ErrCursor )
View Source
var AllConnection = ConnectionBuffers{ Connections: make(map[string]*Connections), }
AllConnection variable
View Source
var AllSqlConnection = SqlConnectionBuffers{ Connections: make(map[string]*SqlConnections), }
AllSqlConnection variable
Functions ¶
Types ¶
type ConnectionBuffers ¶
type ConnectionBuffers struct { sync.RWMutex Connections map[string]*Connections }
ConnectionBuffers struct
type Connections ¶
type Connections struct { sync.RWMutex Session *mgo.Session Database *mgo.Database Collection *mgo.Collection Indexed bool Option *Resource URI string }
Connections struct
func NewConnection ¶
func NewConnection(resourceName string) (*Connections, error)
NewConnection function
func NewConnectionURI ¶
func NewConnectionURI(uri string) (*Connections, error)
NewConnectionURI function
type DBResources ¶
type DBResources struct {
Resources []*Resource `json:"dbResources" bson:"dbResources"`
}
DBResources struct
type Resource ¶
type Resource struct { Name string `json:"name" bson:"name"` Engine string `json:"engine" bson:"engine"` Host string `json:"host" bson:"host"` Port string `json:"port" bson:"port"` Username string `json:"username" bson:"username"` Password string `json:"password" bson:"password"` Db string `json:"db" bson:"db"` Ssl bool `json:"ssl" bson:"ssl"` }
Resource struct
func GetResource ¶
GetResource function
type SqlConnectionBuffers ¶
type SqlConnectionBuffers struct { sync.RWMutex Connections map[string]*SqlConnections }
SqlConnectionBuffers struct
type SqlConnections ¶
type SqlConnections struct { sync.RWMutex Database *sql.DB Indexed bool Option *Resource URI string }
SqlConnections struct
func NewSqlConnection ¶
func NewSqlConnection(resourceName string) (*SqlConnections, error)
NewSqlConnection function
func NewSqlConnectionURI ¶
func NewSqlConnectionURI(uri string) (*SqlConnections, error)
NewSqlConnectionURI function
func (*SqlConnections) CheckConnection ¶
func (c *SqlConnections) CheckConnection() error
CheckConnection method
Click to show internal directories.
Click to hide internal directories.