Skip to content

Commit

Permalink
Add comments to function and struct
Browse files Browse the repository at this point in the history
  • Loading branch information
gnokoheat authored Nov 9, 2019
1 parent 984171e commit 806fdc3
Showing 1 changed file with 4 additions and 10 deletions.
14 changes: 4 additions & 10 deletions oplog.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
"gopkg.in/mgo.v2/bson"
)

// Options :
// Options : MongoDB connection information for oplog tailing
type Options struct {
Addrs []string
Username string
Expand All @@ -20,13 +20,7 @@ type Options struct {
Events []string
}

// LogC :
type LogC chan *[]Log

// ErrC :
type ErrC chan error

// Log :
// Log : Oplog document
type Log struct {
Timestamp time.Time `json:"wall" bson:"wall"`
HistoryID int64 `json:"h" bson:"h"`
Expand All @@ -37,7 +31,7 @@ type Log struct {
Update map[string]interface{} `json:"o2" bson:"o2"`
}

// MgoConn :
// MgoConn : MongoDB connect
func (o *Options) MgoConn(e chan error) (*mgo.Session, *mgo.Collection) {
var mgoSess *mgo.Session
var mgoColl *mgo.Collection
Expand Down Expand Up @@ -66,7 +60,7 @@ func (o *Options) MgoConn(e chan error) (*mgo.Session, *mgo.Collection) {
return mgoSess, mgoColl
}

// Tail :
// Tail : MongoDB oplog tailing start
func (o *Options) Tail(l chan *[]Log, e chan error) {
bsonInsert := bson.M{}
bsonUpdate := bson.M{}
Expand Down

0 comments on commit 806fdc3

Please sign in to comment.