MCPcopy Create free account
hub / github.com/pace/bricks / assign

Function assign

http/jsonapi/request.go:353–365  ·  view source on GitHub ↗

assign will take the value specified and assign it to the field; if field is expecting a ptr assign will assign a ptr.

(field, value reflect.Value)

Source from the content-addressed store, hash-verified

351// assign will take the value specified and assign it to the field; if
352// field is expecting a ptr assign will assign a ptr.
353func assign(field, value reflect.Value) {
354 value = reflect.Indirect(value)
355
356 if field.Kind() == reflect.Ptr {
357 // initialize pointer so it's value
358 // can be set by assignValue
359 field.Set(reflect.New(field.Type().Elem()))
360 field = field.Elem()
361
362 }
363
364 assignValue(field, value)
365}
366
367// assign assigns the specified value to the field,
368// expecting both values not to be pointer types.

Callers 1

unmarshalNodeFunction · 0.85

Calls 3

assignValueFunction · 0.85
SetMethod · 0.80
TypeMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…