You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
29 lines
452 B
Go
29 lines
452 B
Go
3 years ago
|
package mongo
|
||
|
|
||
|
import (
|
||
|
"time"
|
||
|
|
||
|
"github.com/tal-tech/go-zero/core/syncx"
|
||
|
)
|
||
|
|
||
|
var slowThreshold = syncx.ForAtomicDuration(defaultSlowThreshold)
|
||
|
|
||
|
type (
|
||
|
options struct {
|
||
|
timeout time.Duration
|
||
|
}
|
||
|
|
||
|
// Option defines the method to customize a mongo model.
|
||
|
Option func(opts *options)
|
||
|
)
|
||
|
|
||
|
func SetSlowThreshold(threshold time.Duration) {
|
||
|
slowThreshold.Set(threshold)
|
||
|
}
|
||
|
|
||
|
func defaultOptions() *options {
|
||
|
return &options{
|
||
|
timeout: defaultTimeout,
|
||
|
}
|
||
|
}
|