mongoutils

package
v0.0.0-...-7a64a06 Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2023 License: MIT Imports: 7 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

func NewClient

func NewClient(uri string, database string, timeout time.Duration) (*Client, error)

func (*Client) AssertIndex

func (c *Client) AssertIndex(collection string, field string) (string, error)

func (*Client) AssertTtlIndex

func (c *Client) AssertTtlIndex(collection string, field string, expireSeconds int32) (string, error)

func (*Client) AssertUniqueIndex

func (c *Client) AssertUniqueIndex(collection string, field string) (string, error)

func (*Client) Close

func (c *Client) Close()

func (*Client) Coll

func (c *Client) Coll(collection string) *mongo.Collection

func (*Client) DeleteMany

func (c *Client) DeleteMany(collection string, filter interface{}) (*mongo.DeleteResult, error)

func (*Client) DeleteOne

func (c *Client) DeleteOne(collection string, filter interface{}) (*mongo.DeleteResult, error)

func (*Client) DeleteOneByField

func (c *Client) DeleteOneByField(collection string, field string, value interface{}) (*mongo.DeleteResult, error)

func (*Client) DeleteOneById

func (c *Client) DeleteOneById(collection string, id interface{}) (*mongo.DeleteResult, error)

func (*Client) FindMany

func (c *Client) FindMany(collection string, filter interface{}, sort interface{}, limit int64, v interface{}) error

func (*Client) FindManyByField

func (c *Client) FindManyByField(collection string, field string, value interface{}, limit int64, v interface{}) error

func (*Client) FindOne

func (c *Client) FindOne(collection string, filter interface{}, v interface{}) (bool, error)

func (*Client) FindOneByField

func (c *Client) FindOneByField(collection string, field string, value interface{}, v interface{}) (bool, error)

func (*Client) FindOneById

func (c *Client) FindOneById(collection string, id interface{}, v interface{}) (bool, error)

func (*Client) InsertMany

func (c *Client) InsertMany(collection string, v []interface{}) (*mongo.InsertManyResult, error)

func (*Client) InsertOne

func (c *Client) InsertOne(collection string, v interface{}) (*mongo.InsertOneResult, error)

func (*Client) Ping

func (c *Client) Ping() error

func (*Client) UpdateOne

func (c *Client) UpdateOne(collection string, filter interface{}, update interface{}) (*mongo.UpdateResult, error)

func (*Client) UpdateOneByField

func (c *Client) UpdateOneByField(collection string, field string, value interface{}, update interface{}) (*mongo.UpdateResult, error)

func (*Client) UpdateOneById

func (c *Client) UpdateOneById(collection string, id interface{}, update interface{}) (*mongo.UpdateResult, error)

func (*Client) UpsertOne

func (c *Client) UpsertOne(collection string, filter interface{}, update interface{}) (*mongo.UpdateResult, error)

func (*Client) UpsertOneByField

func (c *Client) UpsertOneByField(collection string, field string, value interface{}, update interface{}) (*mongo.UpdateResult, error)

func (*Client) UpsertOneById

func (c *Client) UpsertOneById(collection string, id interface{}, update interface{}) (*mongo.UpdateResult, error)

Jump to

Keyboard shortcuts

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