db

package
v0.0.0-...-76fdd16 Latest Latest
Warning

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

Go to latest
Published: Jul 9, 2020 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	Connected bool
	Database  string
	// contains filtered or unexported fields
}

Client database

func New

func New() *Client

New creates a new Client object

func (*Client) C

func (dba *Client) C(coll string) *mongo.Collection

C opens a given collection in the xdcc database

func (*Client) Close

func (dba *Client) Close() error

Close connection

func (*Client) Connect

func (dba *Client) Connect(host string)

Connect Connects to the xdcc database

func (*Client) Delete

func (dba *Client) Delete(coll string, key string, value string) (*mongo.DeleteResult, error)

Delete returns all entities of a given collection

func (*Client) DeleteAll

func (dba *Client) DeleteAll(coll string) (*mongo.DeleteResult, error)

DeleteAll returns all entities of a given collection

func (*Client) DeleteByID

func (dba *Client) DeleteByID(coll string, id string) (*mongo.DeleteResult, error)

DeleteByID returns all entities of a given collection

func (*Client) Find

func (dba *Client) Find(coll string, key string, value string) (*mongo.Cursor, error)

Find returns all entities of a given collection

func (*Client) FindAll

func (dba *Client) FindAll(coll string) (*mongo.Cursor, error)

FindAll returns all entities of a given collection

func (*Client) FindByID

func (dba *Client) FindByID(coll string, id string) *mongo.SingleResult

FindByID returns all entities of a given collection

func (*Client) FindOne

func (dba *Client) FindOne(coll string, key string, value string) *mongo.SingleResult

FindOne returns all entities of a given collection

func (*Client) IDFromObjectID

func (dba *Client) IDFromObjectID(bid interface{}) string

IDFromObjectID ...

func (*Client) InsertOne

func (dba *Client) InsertOne(coll string, data interface{}) (*mongo.InsertOneResult, error)

InsertOne inserts one document

func (*Client) UpdateOne

func (dba *Client) UpdateOne(coll string, key string, value string, data interface{}) (*mongo.UpdateResult, error)

UpdateOne inserts one document

func (*Client) UpdateOneByID

func (dba *Client) UpdateOneByID(coll string, id primitive.ObjectID, data interface{}) (*mongo.UpdateResult, error)

UpdateOneByID inserts one document

Jump to

Keyboard shortcuts

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