github.com/lingyao2333/mo-zero@v1.4.1/core/stores/mon/options.go (about)

     1  package mon
     2  
     3  import (
     4  	"time"
     5  
     6  	"github.com/lingyao2333/mo-zero/core/syncx"
     7  )
     8  
     9  var slowThreshold = syncx.ForAtomicDuration(defaultSlowThreshold)
    10  
    11  type (
    12  	options struct {
    13  		timeout time.Duration
    14  	}
    15  
    16  	// Option defines the method to customize a mongo model.
    17  	Option func(opts *options)
    18  )
    19  
    20  // SetSlowThreshold sets the slow threshold.
    21  func SetSlowThreshold(threshold time.Duration) {
    22  	slowThreshold.Set(threshold)
    23  }
    24  
    25  func defaultOptions() *options {
    26  	return &options{
    27  		timeout: defaultTimeout,
    28  	}
    29  }