github.com/volts-dev/volts@v0.0.0-20240120094013-5e9c65924106/internal/pool/config.go (about)

     1  package pool
     2  
     3  import (
     4  	"time"
     5  
     6  	"github.com/volts-dev/volts/transport"
     7  )
     8  
     9  type Config struct {
    10  	Transport transport.ITransport
    11  	TTL       time.Duration
    12  	Size      int
    13  }
    14  
    15  type Option func(*Config)
    16  
    17  func Size(i int) Option {
    18  	return func(o *Config) {
    19  		o.Size = i
    20  	}
    21  }
    22  
    23  func Transport(t transport.ITransport) Option {
    24  	return func(o *Config) {
    25  		o.Transport = t
    26  	}
    27  }
    28  
    29  func TTL(t time.Duration) Option {
    30  	return func(o *Config) {
    31  		o.TTL = t
    32  	}
    33  }