MCPcopy
hub / github.com/redis/go-redis / Struct

Function Struct

internal/hscan/hscan.go:55–72  ·  view source on GitHub ↗
(dst interface{})

Source from the content-addressed store, hash-verified

53)
54
55func Struct(dst interface{}) (StructValue, error) {
56 v := reflect.ValueOf(dst)
57
58 // The destination to scan into should be a struct pointer.
59 if v.Kind() != reflect.Ptr || v.IsNil() {
60 return StructValue{}, fmt.Errorf("redis.Scan(non-pointer %T)", dst)
61 }
62
63 v = v.Elem()
64 if v.Kind() != reflect.Struct {
65 return StructValue{}, fmt.Errorf("redis.Scan(non-struct %T)", dst)
66 }
67
68 return StructValue{
69 spec: globalStructMap.get(v.Type()),
70 value: v,
71 }, nil
72}
73
74// Scan scans the results from a key-value Redis map result set to a destination struct.
75// The Redis keys are matched to the struct's field with the `redis` tag.

Callers 2

ScanMethod · 0.92
ScanFunction · 0.85

Calls 2

TypeMethod · 0.65
getMethod · 0.45

Tested by

no test coverage detected