@@ -316,3 +316,66 @@ func SetInternalInsertOneOptions(a *options.InsertOneOptionsBuilder, key string,
316316 }
317317 return nil
318318}
319+
320+ // SetInternalReplaceOptions sets internal options for ReplaceOptions.
321+ func SetInternalReplaceOptions (a * options.ReplaceOptionsBuilder , key string , option any ) error {
322+ typeErrFunc := func (t string ) error {
323+ return fmt .Errorf ("unexpected type for %q: %T is not %s" , key , option , t )
324+ }
325+ switch key {
326+ case "rawData" :
327+ b , ok := option .(bool )
328+ if ! ok {
329+ return typeErrFunc ("bool" )
330+ }
331+ a .Opts = append (a .Opts , func (opts * options.ReplaceOptions ) error {
332+ opts .Internal = optionsutil .WithValue (opts .Internal , key , b )
333+ return nil
334+ })
335+ default :
336+ return fmt .Errorf ("unsupported option: %q" , key )
337+ }
338+ return nil
339+ }
340+
341+ // SetInternalUpdateManyOptions sets internal options for UpdateManyOptions.
342+ func SetInternalUpdateManyOptions (a * options.UpdateManyOptionsBuilder , key string , option any ) error {
343+ typeErrFunc := func (t string ) error {
344+ return fmt .Errorf ("unexpected type for %q: %T is not %s" , key , option , t )
345+ }
346+ switch key {
347+ case "rawData" :
348+ b , ok := option .(bool )
349+ if ! ok {
350+ return typeErrFunc ("bool" )
351+ }
352+ a .Opts = append (a .Opts , func (opts * options.UpdateManyOptions ) error {
353+ opts .Internal = optionsutil .WithValue (opts .Internal , key , b )
354+ return nil
355+ })
356+ default :
357+ return fmt .Errorf ("unsupported option: %q" , key )
358+ }
359+ return nil
360+ }
361+
362+ // SetInternalUpdateOneOptions sets internal options for UpdateOneOptions.
363+ func SetInternalUpdateOneOptions (a * options.UpdateOneOptionsBuilder , key string , option any ) error {
364+ typeErrFunc := func (t string ) error {
365+ return fmt .Errorf ("unexpected type for %q: %T is not %s" , key , option , t )
366+ }
367+ switch key {
368+ case "rawData" :
369+ b , ok := option .(bool )
370+ if ! ok {
371+ return typeErrFunc ("bool" )
372+ }
373+ a .Opts = append (a .Opts , func (opts * options.UpdateOneOptions ) error {
374+ opts .Internal = optionsutil .WithValue (opts .Internal , key , b )
375+ return nil
376+ })
377+ default :
378+ return fmt .Errorf ("unsupported option: %q" , key )
379+ }
380+ return nil
381+ }
0 commit comments