From d9494e6884866aece4c5f5f56c5889fb49805b4e Mon Sep 17 00:00:00 2001 From: David Cuadrado Date: Mon, 29 Jan 2024 16:00:22 -0500 Subject: [PATCH] Add ScanRef function It receives a reflect.Value as reference and sets the value into it. This function helps implementing ORMs. closes #520 --- internal/object/scan.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/internal/object/scan.go b/internal/object/scan.go index 0b733b14..4d7e9ee0 100644 --- a/internal/object/scan.go +++ b/internal/object/scan.go @@ -228,6 +228,11 @@ func ScanValue(v types.Value, t any) error { return scanValue(v, reflect.ValueOf(t)) } +// ScanRef scans the given value v into the reference ref +func ScanRef(v types.Value, ref reflect.Value) error { + return scanValue(v, ref) +} + func scanValue(v types.Value, ref reflect.Value) error { if !ref.IsValid() { return &ErrUnsupportedType{ref, "parameter is not a valid reference"}