Documentation ¶
Overview ¶
Code generated by github.com/ecordell/optgen. DO NOT EDIT.
Index ¶
- func DefaultPreRunE(programName string) cobrautil.CobraRunFunc
- func MetricsHandler() http.Handler
- func NewDatastore(options ...Option) (datastore.Datastore, error)
- func RegisterDatastoreFlags(cmd *cobra.Command, opts *DatastoreConfig)
- func ServeExample(programName string) string
- func SignalContextWithGracePeriod(ctx context.Context, gracePeriod time.Duration) context.Context
- type DatastoreConfig
- type DatastoreConfigOption
- func WithEngine(engine string) DatastoreConfigOption
- func WithFollowerReadDelay(followerReadDelay time.Duration) DatastoreConfigOption
- func WithGCInterval(gCInterval time.Duration) DatastoreConfigOption
- func WithGCMaxOperationTime(gCMaxOperationTime time.Duration) DatastoreConfigOption
- func WithGCWindow(gCWindow time.Duration) DatastoreConfigOption
- func WithHealthCheckPeriod(healthCheckPeriod time.Duration) DatastoreConfigOption
- func WithMaxIdleTime(maxIdleTime time.Duration) DatastoreConfigOption
- func WithMaxLifetime(maxLifetime time.Duration) DatastoreConfigOption
- func WithMaxOpenConns(maxOpenConns int) DatastoreConfigOption
- func WithMaxRetries(maxRetries int) DatastoreConfigOption
- func WithMinOpenConns(minOpenConns int) DatastoreConfigOption
- func WithOverlapKey(overlapKey string) DatastoreConfigOption
- func WithOverlapStrategy(overlapStrategy string) DatastoreConfigOption
- func WithRevisionQuantization(revisionQuantization time.Duration) DatastoreConfigOption
- func WithSplitQuerySize(splitQuerySize string) DatastoreConfigOption
- func WithURI(uRI string) DatastoreConfigOption
- type Option
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DefaultPreRunE ¶
func DefaultPreRunE(programName string) cobrautil.CobraRunFunc
DefaultPreRunE sets up viper, zerolog, and OpenTelemetry flag handling for a command.
func MetricsHandler ¶
MetricsHandler sets up an HTTP server that handles serving Prometheus metrics and pprof endpoints.
func NewDatastore ¶
NewDatastore initializes a datastore given the options
func RegisterDatastoreFlags ¶
func RegisterDatastoreFlags(cmd *cobra.Command, opts *DatastoreConfig)
RegisterDatastoreFlags adds datastore flags to a cobra command
func ServeExample ¶
ServeExample creates an example usage string with the provided program name.
func SignalContextWithGracePeriod ¶
SignalContextWithGracePeriod creates a new context that will be cancelled when an interrupt/SIGTERM signal is received and the provided grace period subsequently finishes.
Types ¶
type DatastoreConfig ¶
type DatastoreConfig struct { Engine string URI string GCWindow time.Duration RevisionQuantization time.Duration MaxIdleTime time.Duration MaxLifetime time.Duration MaxOpenConns int MinOpenConns int SplitQuerySize string // CRDB FollowerReadDelay time.Duration MaxRetries int OverlapKey string OverlapStrategy string // Postgres HealthCheckPeriod time.Duration GCInterval time.Duration GCMaxOperationTime time.Duration }
func DatastoreConfigWithOptions ¶
func DatastoreConfigWithOptions(d *DatastoreConfig, opts ...DatastoreConfigOption) *DatastoreConfig
DatastoreConfigWithOptions configures an existing DatastoreConfig with the passed in options set
func NewDatastoreConfigWithOptions ¶
func NewDatastoreConfigWithOptions(opts ...DatastoreConfigOption) *DatastoreConfig
NewDatastoreConfigWithOptions creates a new DatastoreConfig with the passed in options set
func (*DatastoreConfig) ToOption ¶
func (o *DatastoreConfig) ToOption() Option
type DatastoreConfigOption ¶
type DatastoreConfigOption func(d *DatastoreConfig)
func WithEngine ¶
func WithEngine(engine string) DatastoreConfigOption
WithEngine returns an option that can set Engine on a DatastoreConfig
func WithFollowerReadDelay ¶
func WithFollowerReadDelay(followerReadDelay time.Duration) DatastoreConfigOption
WithFollowerReadDelay returns an option that can set FollowerReadDelay on a DatastoreConfig
func WithGCInterval ¶
func WithGCInterval(gCInterval time.Duration) DatastoreConfigOption
WithGCInterval returns an option that can set GCInterval on a DatastoreConfig
func WithGCMaxOperationTime ¶
func WithGCMaxOperationTime(gCMaxOperationTime time.Duration) DatastoreConfigOption
WithGCMaxOperationTime returns an option that can set GCMaxOperationTime on a DatastoreConfig
func WithGCWindow ¶
func WithGCWindow(gCWindow time.Duration) DatastoreConfigOption
WithGCWindow returns an option that can set GCWindow on a DatastoreConfig
func WithHealthCheckPeriod ¶
func WithHealthCheckPeriod(healthCheckPeriod time.Duration) DatastoreConfigOption
WithHealthCheckPeriod returns an option that can set HealthCheckPeriod on a DatastoreConfig
func WithMaxIdleTime ¶
func WithMaxIdleTime(maxIdleTime time.Duration) DatastoreConfigOption
WithMaxIdleTime returns an option that can set MaxIdleTime on a DatastoreConfig
func WithMaxLifetime ¶
func WithMaxLifetime(maxLifetime time.Duration) DatastoreConfigOption
WithMaxLifetime returns an option that can set MaxLifetime on a DatastoreConfig
func WithMaxOpenConns ¶
func WithMaxOpenConns(maxOpenConns int) DatastoreConfigOption
WithMaxOpenConns returns an option that can set MaxOpenConns on a DatastoreConfig
func WithMaxRetries ¶
func WithMaxRetries(maxRetries int) DatastoreConfigOption
WithMaxRetries returns an option that can set MaxRetries on a DatastoreConfig
func WithMinOpenConns ¶
func WithMinOpenConns(minOpenConns int) DatastoreConfigOption
WithMinOpenConns returns an option that can set MinOpenConns on a DatastoreConfig
func WithOverlapKey ¶
func WithOverlapKey(overlapKey string) DatastoreConfigOption
WithOverlapKey returns an option that can set OverlapKey on a DatastoreConfig
func WithOverlapStrategy ¶
func WithOverlapStrategy(overlapStrategy string) DatastoreConfigOption
WithOverlapStrategy returns an option that can set OverlapStrategy on a DatastoreConfig
func WithRevisionQuantization ¶
func WithRevisionQuantization(revisionQuantization time.Duration) DatastoreConfigOption
WithRevisionQuantization returns an option that can set RevisionQuantization on a DatastoreConfig
func WithSplitQuerySize ¶
func WithSplitQuerySize(splitQuerySize string) DatastoreConfigOption
WithSplitQuerySize returns an option that can set SplitQuerySize on a DatastoreConfig
func WithURI ¶
func WithURI(uRI string) DatastoreConfigOption
WithURI returns an option that can set URI on a DatastoreConfig
type Option ¶
type Option func(*DatastoreConfig)