feat: slow threshold customizable in mongo (#1186)

This commit is contained in:
Kevin Wan
2021-11-01 07:12:53 +08:00
committed by GitHub
parent 429f85a9de
commit 8be0f77d96
6 changed files with 68 additions and 23 deletions

View File

@@ -8,23 +8,14 @@ import (
"github.com/tal-tech/go-zero/core/breaker"
)
type (
options struct {
timeout time.Duration
}
// Option defines the method to customize a mongo model.
Option func(opts *options)
// A Model is a mongo model.
Model struct {
session *concurrentSession
db *mgo.Database
collection string
brk breaker.Breaker
opts []Option
}
)
// A Model is a mongo model.
type Model struct {
session *concurrentSession
db *mgo.Database
collection string
brk breaker.Breaker
opts []Option
}
// MustNewModel returns a Model, exits on errors.
func MustNewModel(url, collection string, opts ...Option) *Model {