github.com/zuoyebang/bitalosdb@v1.1.1-0.20240516111551-79a8c4d8ce20/internal/options/options.go (about)

     1  // Copyright 2021 The Bitalosdb author(hustxrb@163.com) and other contributors.
     2  //
     3  // Licensed under the Apache License, Version 2.0 (the "License");
     4  // you may not use this file except in compliance with the License.
     5  // You may obtain a copy of the License at
     6  //
     7  //     http://www.apache.org/licenses/LICENSE-2.0
     8  //
     9  // Unless required by applicable law or agreed to in writing, software
    10  // distributed under the License is distributed on an "AS IS" BASIS,
    11  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    12  // See the License for the specific language governing permissions and
    13  // limitations under the License.
    14  
    15  package options
    16  
    17  import "github.com/zuoyebang/bitalosdb/internal/base"
    18  
    19  type IterOptions struct {
    20  	LowerBound   []byte
    21  	UpperBound   []byte
    22  	Logger       base.Logger
    23  	SlotId       uint32
    24  	IsAll        bool
    25  	DisableCache bool
    26  }
    27  
    28  func (o *IterOptions) GetLowerBound() []byte {
    29  	if o == nil {
    30  		return nil
    31  	}
    32  	return o.LowerBound
    33  }
    34  
    35  func (o *IterOptions) GetUpperBound() []byte {
    36  	if o == nil {
    37  		return nil
    38  	}
    39  	return o.UpperBound
    40  }
    41  
    42  func (o *IterOptions) GetLogger() base.Logger {
    43  	if o == nil || o.Logger == nil {
    44  		return base.DefaultLogger
    45  	}
    46  	return o.Logger
    47  }
    48  
    49  func (o *IterOptions) GetSlotId() uint32 {
    50  	if o == nil {
    51  		return 0
    52  	}
    53  	return o.SlotId
    54  }
    55  
    56  func (o *IterOptions) IsGetAll() bool {
    57  	return o == nil || o.IsAll
    58  }