github.com/lastbackend/toolkit@v0.0.0-20241020043710-cafa37b95aad/pkg/runtime/options.go (about)

     1  package runtime
     2  
     3  const (
     4  	MetaOptionEnvPrefix   = "envPrefix"
     5  	MetaOptionVersion     = "version"
     6  	MetaOptionDescription = "description"
     7  )
     8  
     9  type Option interface {
    10  	Name() string
    11  	Value() string
    12  }
    13  
    14  type Options []Option
    15  
    16  type option struct {
    17  	name  string
    18  	value string
    19  }
    20  
    21  func (o *option) Name() string {
    22  	return o.name
    23  }
    24  
    25  func (o *option) Value() string {
    26  	return o.value
    27  }
    28  
    29  func WithEnvPrefix(prefix string) Option {
    30  	return &option{name: MetaOptionEnvPrefix, value: prefix}
    31  }
    32  
    33  func WithVersion(version string) Option {
    34  	return &option{name: MetaOptionVersion, value: version}
    35  }
    36  
    37  func WithDescription(description string) Option {
    38  	return &option{name: MetaOptionDescription, value: description}
    39  }