client

package
v1.0.5 Latest Latest
Warning

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

Go to latest
Published: Oct 4, 2020 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Connect

type Connect struct {
	// contains filtered or unexported fields
}

Connect used to initialize the connection.

func NewConnection

func NewConnection(options ...Options) *Connect

NewConnection function used to initialize the connection client.

func (*Connect) CreateDocument

func (conn *Connect) CreateDocument(collectionName string, props interface{}) error

CreateDocument function was create the new document record in given collection.

func (*Connect) DeleteByID added in v1.0.2

func (conn *Connect) DeleteByID(collectionName string, id string) (deleteCount int64, err error)

DeleteByID function was delete the document record from given collection.

func (*Connect) FindByID added in v1.0.2

func (conn *Connect) FindByID(collectionName string, ID string) (result bson.M, err error)

FindByID function find the first matching document in collection based on given ID.

func (*Connect) FindOne

func (conn *Connect) FindOne(collectionName string, q interface{}) (result bson.M, err error)

FindOne function find the first matching document in collection based on given query.

func (*Connect) Search

func (conn *Connect) Search(collectionName string, q interface{}, skip int, limit int) (searchResults []bson.M, err error)

Search function search the document based on given search query.

func (*Connect) UpdateDocByID added in v1.0.3

func (conn *Connect) UpdateDocByID(collection string, id string, data interface{}) (updatedDoc bson.M, err error)

UpdateDocByID function update the document by given id

type Options added in v1.0.4

type Options func(c *Connect)

Options the self referenceing function to set the config

func WithCtx added in v1.0.4

func WithCtx(ctx context.Context) Options

WithCtx self referenceing function to set the context

func WithDatabase added in v1.0.5

func WithDatabase(database string) Options

WithDatabase self referenceing function to set the database name.

func WithLogLevel added in v1.0.4

func WithLogLevel(level string) Options

WithLogLevel self referenceing function to set the log level for the logrus.

func WithURL added in v1.0.4

func WithURL(url string) Options

WithURL self referenceing function to set the url

Jump to

Keyboard shortcuts

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