github.com/authzed/spicedb@v1.32.1-0.20240520085336-ebda56537386/internal/services/v1/options/zz_generated.query_options.go (about)

     1  // Code generated by github.com/ecordell/optgen. DO NOT EDIT.
     2  package options
     3  
     4  import (
     5  	defaults "github.com/creasty/defaults"
     6  	helpers "github.com/ecordell/optgen/helpers"
     7  	"time"
     8  )
     9  
    10  type ExperimentalServerOptionsOption func(e *ExperimentalServerOptions)
    11  
    12  // NewExperimentalServerOptionsWithOptions creates a new ExperimentalServerOptions with the passed in options set
    13  func NewExperimentalServerOptionsWithOptions(opts ...ExperimentalServerOptionsOption) *ExperimentalServerOptions {
    14  	e := &ExperimentalServerOptions{}
    15  	for _, o := range opts {
    16  		o(e)
    17  	}
    18  	return e
    19  }
    20  
    21  // NewExperimentalServerOptionsWithOptionsAndDefaults creates a new ExperimentalServerOptions with the passed in options set starting from the defaults
    22  func NewExperimentalServerOptionsWithOptionsAndDefaults(opts ...ExperimentalServerOptionsOption) *ExperimentalServerOptions {
    23  	e := &ExperimentalServerOptions{}
    24  	defaults.MustSet(e)
    25  	for _, o := range opts {
    26  		o(e)
    27  	}
    28  	return e
    29  }
    30  
    31  // ToOption returns a new ExperimentalServerOptionsOption that sets the values from the passed in ExperimentalServerOptions
    32  func (e *ExperimentalServerOptions) ToOption() ExperimentalServerOptionsOption {
    33  	return func(to *ExperimentalServerOptions) {
    34  		to.StreamReadTimeout = e.StreamReadTimeout
    35  		to.DefaultExportBatchSize = e.DefaultExportBatchSize
    36  		to.MaxExportBatchSize = e.MaxExportBatchSize
    37  		to.BulkCheckMaxConcurrency = e.BulkCheckMaxConcurrency
    38  	}
    39  }
    40  
    41  // DebugMap returns a map form of ExperimentalServerOptions for debugging
    42  func (e ExperimentalServerOptions) DebugMap() map[string]any {
    43  	debugMap := map[string]any{}
    44  	debugMap["StreamReadTimeout"] = helpers.DebugValue(e.StreamReadTimeout, false)
    45  	debugMap["DefaultExportBatchSize"] = helpers.DebugValue(e.DefaultExportBatchSize, false)
    46  	debugMap["MaxExportBatchSize"] = helpers.DebugValue(e.MaxExportBatchSize, false)
    47  	debugMap["BulkCheckMaxConcurrency"] = helpers.DebugValue(e.BulkCheckMaxConcurrency, false)
    48  	return debugMap
    49  }
    50  
    51  // ExperimentalServerOptionsWithOptions configures an existing ExperimentalServerOptions with the passed in options set
    52  func ExperimentalServerOptionsWithOptions(e *ExperimentalServerOptions, opts ...ExperimentalServerOptionsOption) *ExperimentalServerOptions {
    53  	for _, o := range opts {
    54  		o(e)
    55  	}
    56  	return e
    57  }
    58  
    59  // WithOptions configures the receiver ExperimentalServerOptions with the passed in options set
    60  func (e *ExperimentalServerOptions) WithOptions(opts ...ExperimentalServerOptionsOption) *ExperimentalServerOptions {
    61  	for _, o := range opts {
    62  		o(e)
    63  	}
    64  	return e
    65  }
    66  
    67  // WithStreamReadTimeout returns an option that can set StreamReadTimeout on a ExperimentalServerOptions
    68  func WithStreamReadTimeout(streamReadTimeout time.Duration) ExperimentalServerOptionsOption {
    69  	return func(e *ExperimentalServerOptions) {
    70  		e.StreamReadTimeout = streamReadTimeout
    71  	}
    72  }
    73  
    74  // WithDefaultExportBatchSize returns an option that can set DefaultExportBatchSize on a ExperimentalServerOptions
    75  func WithDefaultExportBatchSize(defaultExportBatchSize uint32) ExperimentalServerOptionsOption {
    76  	return func(e *ExperimentalServerOptions) {
    77  		e.DefaultExportBatchSize = defaultExportBatchSize
    78  	}
    79  }
    80  
    81  // WithMaxExportBatchSize returns an option that can set MaxExportBatchSize on a ExperimentalServerOptions
    82  func WithMaxExportBatchSize(maxExportBatchSize uint32) ExperimentalServerOptionsOption {
    83  	return func(e *ExperimentalServerOptions) {
    84  		e.MaxExportBatchSize = maxExportBatchSize
    85  	}
    86  }
    87  
    88  // WithBulkCheckMaxConcurrency returns an option that can set BulkCheckMaxConcurrency on a ExperimentalServerOptions
    89  func WithBulkCheckMaxConcurrency(bulkCheckMaxConcurrency uint16) ExperimentalServerOptionsOption {
    90  	return func(e *ExperimentalServerOptions) {
    91  		e.BulkCheckMaxConcurrency = bulkCheckMaxConcurrency
    92  	}
    93  }