MCPcopy
hub / github.com/grafana/tempo / Equals

Method Equals

pkg/traceql/ast.go:826–866  ·  view source on GitHub ↗
(o *Static)

Source from the content-addressed store, hash-verified

824}
825
826func (s Static) Equals(o *Static) bool {
827 // if one is nil, they are not equal
828 if s.Type == TypeNil || o.Type == TypeNil {
829 return false
830 }
831
832 switch s.Type {
833 case TypeInt, TypeDuration:
834 switch o.Type {
835 case TypeInt, TypeDuration:
836 return s.valScalar == o.valScalar
837 case TypeStatus:
838 // only int can be compared to status
839 return s.Type == TypeInt && s.valScalar == o.valScalar
840 case TypeFloat:
841 of := math.Float64frombits(o.valScalar)
842 return s.Float() == of
843 default:
844 return false
845 }
846 case TypeStatus:
847 switch o.Type {
848 case TypeInt, TypeStatus:
849 return s.valScalar == o.valScalar
850 default:
851 return false
852 }
853 case TypeFloat:
854 sf := math.Float64frombits(s.valScalar)
855 return sf == o.Float()
856 case TypeKind, TypeBoolean:
857 return s.Type == o.Type && s.valScalar == o.valScalar
858 case TypeString, TypeIntArray, TypeFloatArray, TypeBooleanArray:
859 return s.Type == o.Type && bytes.Equal(s.valBytes, o.valBytes)
860 case TypeStringArray:
861 return s.Type == o.Type && slices.Equal(s.valStrings, o.valStrings)
862 default:
863 // should not be reached
864 return false
865 }
866}
867
868func (s Static) NotEquals(o *Static) bool {
869 if s.Type == TypeNil || o.Type == TypeNil {

Callers 15

NotEqualsMethod · 0.95
TestBackendSchedulerFunction · 0.80
TestIngestionLimitsFunction · 0.80
TestLimitsPartialSuccessFunction · 0.80
TestKVStoresFunction · 0.80
verifyPartitionStateFunction · 0.80
waitActivePartitionsFunction · 0.80

Calls 2

FloatMethod · 0.95
EqualMethod · 0.45