mongo

package
v0.0.0-...-2247000 Latest Latest
Warning

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

Go to latest
Published: Jun 23, 2015 License: MIT Imports: 4 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 {
	Conn *mgo.Session
	Conf MongoConf
}

mongodb client struct

func Connect

func Connect(conf MongoConf) *Client

return the client struct

func (*Client) CountAll

func (c *Client) CountAll() int

return total of the documents

func (*Client) GetAll

func (c *Client) GetAll(skip, limit int) []OplogInsert

return all documents

func (*Client) GetOplogsDelete

func (c *Client) GetOplogsDelete() []OplogDelete

return all deleted oplog objects

func (*Client) GetOplogsInsert

func (c *Client) GetOplogsInsert() []OplogInsert

return all inserted oplog objects

func (*Client) GetOplogsUpdate

func (c *Client) GetOplogsUpdate() []OplogUpdate

return all updated oplog objects

type MongoConf

type MongoConf struct {
	Server     string
	Port       string
	User       string
	Pass       string
	Database   string
	Collection string
}

mongodb config struct

type Oplog

type Oplog struct {
	Ts int64  `bson:"ts"`
	H  int    `bson:"h"`
	V  int    `bson:"v"`
	Op string `bson:"op"`
	Ns string `bson:"ns"`
}

base struct of Oplog

type OplogDelete

type OplogDelete struct {
	Oplog `bson:",inline"`
	B     bool                     `bson:"b"`
	O     map[string]bson.ObjectId `bson:"o"`
}

type OplogInsert

type OplogInsert struct {
	Oplog `bson:",inline"`
	O     map[string]interface{} `bson:"o"`
}

struct of Oplog insert object

type OplogUpdate

type OplogUpdate struct {
	Oplog `bson:",inline"`
	O2    map[string]bson.ObjectId `bson:"o2"`
	O     map[string]interface{}   `bson:"o`
}

struct of Oplog update object

Jump to

Keyboard shortcuts

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