github.com/authzed/spicedb@v1.32.1-0.20240520085336-ebda56537386/pkg/datastore/options/zz_generated.delete_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  )
     8  
     9  type DeleteOptionsOption func(d *DeleteOptions)
    10  
    11  // NewDeleteOptionsWithOptions creates a new DeleteOptions with the passed in options set
    12  func NewDeleteOptionsWithOptions(opts ...DeleteOptionsOption) *DeleteOptions {
    13  	d := &DeleteOptions{}
    14  	for _, o := range opts {
    15  		o(d)
    16  	}
    17  	return d
    18  }
    19  
    20  // NewDeleteOptionsWithOptionsAndDefaults creates a new DeleteOptions with the passed in options set starting from the defaults
    21  func NewDeleteOptionsWithOptionsAndDefaults(opts ...DeleteOptionsOption) *DeleteOptions {
    22  	d := &DeleteOptions{}
    23  	defaults.MustSet(d)
    24  	for _, o := range opts {
    25  		o(d)
    26  	}
    27  	return d
    28  }
    29  
    30  // ToOption returns a new DeleteOptionsOption that sets the values from the passed in DeleteOptions
    31  func (d *DeleteOptions) ToOption() DeleteOptionsOption {
    32  	return func(to *DeleteOptions) {
    33  		to.DeleteLimit = d.DeleteLimit
    34  	}
    35  }
    36  
    37  // DebugMap returns a map form of DeleteOptions for debugging
    38  func (d DeleteOptions) DebugMap() map[string]any {
    39  	debugMap := map[string]any{}
    40  	debugMap["DeleteLimit"] = helpers.DebugValue(d.DeleteLimit, false)
    41  	return debugMap
    42  }
    43  
    44  // DeleteOptionsWithOptions configures an existing DeleteOptions with the passed in options set
    45  func DeleteOptionsWithOptions(d *DeleteOptions, opts ...DeleteOptionsOption) *DeleteOptions {
    46  	for _, o := range opts {
    47  		o(d)
    48  	}
    49  	return d
    50  }
    51  
    52  // WithOptions configures the receiver DeleteOptions with the passed in options set
    53  func (d *DeleteOptions) WithOptions(opts ...DeleteOptionsOption) *DeleteOptions {
    54  	for _, o := range opts {
    55  		o(d)
    56  	}
    57  	return d
    58  }
    59  
    60  // WithDeleteLimit returns an option that can set DeleteLimit on a DeleteOptions
    61  func WithDeleteLimit(deleteLimit *uint64) DeleteOptionsOption {
    62  	return func(d *DeleteOptions) {
    63  		d.DeleteLimit = deleteLimit
    64  	}
    65  }