MCPcopy
hub / github.com/TomWright/dasel / Type

Method Type

model/value.go:284–303  ·  view source on GitHub ↗

Type returns the type of the value.

()

Source from the content-addressed store, hash-verified

282
283// Type returns the type of the value.
284func (v *Value) Type() Type {
285 switch {
286 case v.IsString():
287 return TypeString
288 case v.IsInt():
289 return TypeInt
290 case v.IsFloat():
291 return TypeFloat
292 case v.IsBool():
293 return TypeBool
294 case v.IsMap():
295 return TypeMap
296 case v.IsSlice():
297 return TypeSlice
298 case v.IsNull():
299 return TypeNull
300 default:
301 return TypeUnknown
302 }
303}
304
305func (v *Value) IsScalar() bool {
306 unpacked := v.UnpackKinds(reflect.Interface, reflect.Pointer)

Callers 15

SetMethod · 0.95
stringMethod · 0.95
LenMethod · 0.95
CopyMethod · 0.95
GoValueMethod · 0.95
EqualMethod · 0.95
EqualTypeValueMethod · 0.95
AppendMethod · 0.95
SliceLenMethod · 0.95
GetSliceIndexMethod · 0.95
SetSliceIndexMethod · 0.95
GetMapKeyMethod · 0.95

Calls 7

IsStringMethod · 0.95
IsIntMethod · 0.95
IsFloatMethod · 0.95
IsBoolMethod · 0.95
IsMapMethod · 0.95
IsSliceMethod · 0.95
IsNullMethod · 0.95

Tested by 6

TestValue_Type_AllTypesFunction · 0.64
TestReader_EmptyNodeFunction · 0.64
TestReader_EmptyDocumentFunction · 0.64
TestNDJSONFunction · 0.64