gitlab.com/evatix-go/core@v1.3.55/corevalidator/BaseLinesValidators.go (about) 1 package corevalidator 2 3 type BaseLinesValidators struct { 4 LinesValidators []LineValidator `json:"LinesValidators,omitempty"` 5 } 6 7 func (it *BaseLinesValidators) LinesValidatorsLength() int { 8 if it == nil { 9 return 0 10 } 11 12 return len(it.LinesValidators) 13 } 14 15 func (it *BaseLinesValidators) IsEmptyLinesValidators() bool { 16 return it.LinesValidatorsLength() == 0 17 } 18 19 func (it *BaseLinesValidators) HasLinesValidators() bool { 20 return it.LinesValidatorsLength() > 0 21 } 22 23 func (it *BaseLinesValidators) ToLinesValidators() *LinesValidators { 24 length := it.LinesValidatorsLength() 25 linesValidators := NewLinesValidators(length) 26 27 if length == 0 { 28 return linesValidators 29 } 30 31 return linesValidators.Adds(it.LinesValidators...) 32 }