github.com/sandwich-go/boost@v1.3.29/xtime/options.go (about)

     1  package xtime
     2  
     3  import "time"
     4  
     5  //go:generate optionGen  --option_return_previous=false
     6  func OptionsOptionDeclareWithDefault() interface{} {
     7  	return map[string]interface{}{
     8  		// annotation@TickDuration(comment="tick的duration,大于0是自动开启ticker")
     9  		"TickDuration": time.Duration(0),
    10  		// annotation@TickHostingMode(comment="全托管模式,内部起一个协程执行tick的func")
    11  		"TickHostingMode": true,
    12  		// annotation@CountGauge(comment="统计tick数量监控")
    13  		"TickCount": CountGauge(&noopGauge{}),
    14  	}
    15  }
    16  
    17  type CountGauge interface {
    18  	Dec()
    19  	Inc()
    20  }
    21  
    22  var _ CountGauge = (*noopGauge)(nil)
    23  
    24  type noopGauge struct{}
    25  
    26  func (n noopGauge) Dec() {}
    27  
    28  func (n noopGauge) Inc() {}