gitee.com/sy_183/go-common@v1.0.5-0.20231205030221-958cfe129b47/pool/options.go (about)

     1  package pool
     2  
     3  import "gitee.com/sy_183/go-common/option"
     4  
     5  func WithLimit(limit int64) option.AnyOption {
     6  	type limitSetter interface {
     7  		setLimit(limit int64)
     8  	}
     9  	return option.AnyCustom(func(target any) {
    10  		if setter, is := target.(limitSetter); is {
    11  			setter.setLimit(limit)
    12  		}
    13  	})
    14  }