mongoc

package
v0.0.0-...-f6ca644 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 4, 2024 License: Apache-2.0 Imports: 12 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

AllConnection variable

Functions

func GenerateURI

func GenerateURI(option *Resource, db bool) string

GenerateURI function

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) C

func (c *Connections) C(name string)

C method

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) DB

func (c *Connections) DB(name string)

DB 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

func (*Connections) TestFind

func (c *Connections) TestFind()

TestFind method

func (*Connections) TestInsert

func (c *Connections) TestInsert()

TestInsert 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 NewIndex

func NewIndex() *Index

NewIndex function

func (*Index) AddKeys

func (i *Index) AddKeys(keys bson.D) *Index

AddKeys method

func (*Index) SetBackground

func (i *Index) SetBackground(background bool) *Index

SetBackground method

func (*Index) SetName

func (i *Index) SetName(name string) *Index

SetName method

func (*Index) SetSparse

func (i *Index) SetSparse(sparse bool) *Index

SetSparse method

func (*Index) SetUnique

func (i *Index) SetUnique(unique bool) *Index

SetUnique method

type Indexes

type Indexes struct {
	IndexModels []*Index
}

Indexes struct

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

func GetResource(resources []*Resource, resourceName string) *Resource

GetResource function

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL