gitlab.com/evatix-go/core@v1.3.55/coredata/corerange/BaseRange.go (about)

     1  package corerange
     2  
     3  import (
     4  	"fmt"
     5  
     6  	"gitlab.com/evatix-go/core/constants"
     7  )
     8  
     9  type BaseRange struct {
    10  	RawInput         string
    11  	Separator        string
    12  	IsValid          bool
    13  	HasStart, HasEnd bool
    14  }
    15  
    16  func (receiver *BaseRange) CreateRangeInt(minMax *MinMaxInt) *RangeInt {
    17  	return NewRangeInt(
    18  		receiver.RawInput,
    19  		receiver.Separator,
    20  		minMax)
    21  }
    22  
    23  func (receiver *BaseRange) IsInvalid() bool {
    24  	return !receiver.IsValid
    25  }
    26  
    27  func (receiver *BaseRange) BaseRangeClone() *BaseRange {
    28  	return &BaseRange{
    29  		RawInput:  receiver.RawInput,
    30  		Separator: receiver.Separator,
    31  		IsValid:   receiver.IsValid,
    32  		HasStart:  receiver.HasStart,
    33  		HasEnd:    receiver.HasEnd,
    34  	}
    35  }
    36  
    37  func (receiver *BaseRange) String(start, end interface{}) string {
    38  	format := constants.SprintValueFormat +
    39  		receiver.Separator +
    40  		constants.SprintValueFormat
    41  
    42  	return fmt.Sprint(format, start, end)
    43  }