MCPcopy Index your code
hub / github.com/pquerna/ffjson / setXValue

Function setXValue

tests/ff_test.go:389–405  ·  view source on GitHub ↗
(t *testing.T, thing interface{})

Source from the content-addressed store, hash-verified

387}
388
389func setXValue(t *testing.T, thing interface{}) {
390 v := reflect.ValueOf(thing)
391 v = reflect.Indirect(v)
392 f := v.FieldByName("X")
393 switch f.Kind() {
394 case reflect.Bool:
395 f.SetBool(true)
396 case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:
397 f.SetInt(-42)
398 case reflect.Uint, reflect.Uintptr, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64:
399 f.SetUint(42)
400 case reflect.Float32, reflect.Float64:
401 f.SetFloat(3.141592653)
402 case reflect.String:
403 f.SetString("hello world")
404 }
405}
406
407func getXValue(thing interface{}) interface{} {
408 v := reflect.ValueOf(thing)

Callers 1

testCycleFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…