Documentation ¶
Index ¶
- Variables
- func GenerateURI(option *Resource, db bool) string
- type ConnectionBuffers
- type Connections
- func (c *Connections) C(name string)
- func (c *Connections) CheckConnection() error
- func (c *Connections) CreateIndex(index *Index) (string, error)
- func (c *Connections) CreateIndexes(index ...*Index) ([]string, error)
- func (c *Connections) DB(name string)
- func (c *Connections) EnsureIndex(index mongo.IndexModel) (string, error)
- func (c *Connections) EnsureIndexes(indexes ...mongo.IndexModel) ([]string, error)
- func (c *Connections) EnsureIndexesTest() ([]string, error)
- func (c *Connections) TestFind()
- func (c *Connections) TestInsert()
- type DBResources
- type Index
- type Indexes
- type Resource
Constants ¶
This section is empty.
Variables ¶
View Source
var AllConnection = ConnectionBuffers{ Connections: make(map[string]*Connections), }
AllConnection variable
Functions ¶
Types ¶
type ConnectionBuffers ¶
type ConnectionBuffers struct { sync.RWMutex Connections map[string]*Connections }
ConnectionBuffers struct
type Connections ¶
type Connections struct { sync.RWMutex Client *mongo.Client Database *mongo.Database Collection *mongo.Collection 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
func (*Connections) CheckConnection ¶
func (c *Connections) CheckConnection() error
CheckConnection method
func (*Connections) CreateIndex ¶
func (c *Connections) CreateIndex(index *Index) (string, error)
CreateIndex method
func (*Connections) CreateIndexes ¶
func (c *Connections) CreateIndexes(index ...*Index) ([]string, error)
CreateIndexes method
func (*Connections) EnsureIndex ¶
func (c *Connections) EnsureIndex(index mongo.IndexModel) (string, error)
EnsureIndex method
func (*Connections) EnsureIndexes ¶
func (c *Connections) EnsureIndexes(indexes ...mongo.IndexModel) ([]string, error)
EnsureIndexes method
func (*Connections) EnsureIndexesTest ¶
func (c *Connections) EnsureIndexesTest() ([]string, error)
EnsureIndexesTest method
type DBResources ¶
type DBResources struct {
Resources []*Resource `json:"mongoResources" bson:"mongoResources"`
}
DBResources struct
type Index ¶
type Index struct { IndexModel mongo.IndexModel CreateIndexesOptions *options.CreateIndexesOptions }
Index struct
func (*Index) SetBackground ¶
SetBackground method
type Resource ¶
type Resource struct { Name string `json:"name" bson:"name"` Uri string `json:"uri" bson:"uri"` 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
Click to show internal directories.
Click to hide internal directories.