INNER CODE UNIT · Go
func
rwynn/gtm · gtm.go:759
func (buf *OpBuf) Append(op *Op) {
buf.Entries = append(buf.Entries, op)
}
func (buf *OpBuf) IsFull() bool {
return len(buf.Entries) >= buf.BufferSize
}
func (buf *OpBuf) HasOne() bool {
return len(buf.Entries) == 1
}
func (buf *OpBuf) Flush(client *mongo.Client, ctx *OpCtx, o *Options) {
if len(buf.Entries) == 0 {
return
}
ns := make(map[string][]interface{})
byId := make(map[interface{}][]*Op)