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

Method append

pkg/traceql/ast.go:1113–1239  ·  view source on GitHub ↗
(o Static)

Source from the content-addressed store, hash-verified

1111}
1112
1113func (s Static) append(o Static) (Static, bool) {
1114 switch s.Type {
1115 case TypeString:
1116 values := make([]string, 0, 2)
1117 values = append(values, s.EncodeToString(false))
1118
1119 switch o.Type {
1120 case TypeString:
1121 values = append(values, o.EncodeToString(false))
1122 case TypeStringArray:
1123 arr, _ := o.StringArray()
1124 values = append(values, arr...)
1125 default:
1126 return StaticNil, false
1127 }
1128 return NewStaticStringArray(values), true
1129 case TypeStringArray:
1130 values := make([]string, 0, 2)
1131 arr, _ := s.StringArray()
1132 values = append(values, arr...)
1133
1134 switch o.Type {
1135 case TypeString:
1136 values = append(values, o.EncodeToString(false))
1137 case TypeStringArray:
1138 arr, _ = o.StringArray()
1139 values = append(values, arr...)
1140 default:
1141 return StaticNil, false
1142 }
1143 return NewStaticStringArray(values), true
1144 case TypeInt:
1145 values := make([]int, 0, 2)
1146 n, _ := s.Int()
1147 values = append(values, n)
1148
1149 switch o.Type {
1150 case TypeInt:
1151 n, _ = o.Int()
1152 values = append(values, n)
1153 case TypeIntArray:
1154 arr, _ := o.IntArray()
1155 values = append(values, arr...)
1156 default:
1157 return StaticNil, false
1158 }
1159 return NewStaticIntArray(values), true
1160 case TypeIntArray:
1161 values := make([]int, 0, 2)
1162 arr, _ := s.IntArray()
1163 values = append(values, arr...)
1164
1165 switch o.Type {
1166 case TypeInt:
1167 n, _ := o.Int()
1168 values = append(values, n)
1169 case TypeIntArray:
1170 arr, _ := o.IntArray()

Callers 6

TestStatic_appendFunction · 0.45
_appendMethod · 0.45
_showElementMethod · 0.45
showMethod · 0.45
setElementContentMethod · 0.45

Calls 12

EncodeToStringMethod · 0.95
StringArrayMethod · 0.95
IntMethod · 0.95
IntArrayMethod · 0.95
FloatMethod · 0.95
FloatArrayMethod · 0.95
BoolMethod · 0.95
BooleanArrayMethod · 0.95
NewStaticStringArrayFunction · 0.85
NewStaticIntArrayFunction · 0.85
NewStaticFloatArrayFunction · 0.85
NewStaticBooleanArrayFunction · 0.85

Tested by 1

TestStatic_appendFunction · 0.36