Skip to content

Commit

Permalink
Add ScanRef function
Browse files Browse the repository at this point in the history
It receives a reflect.Value as reference and sets the value into it.
This function helps implementing ORMs.

closes chaisql#520
  • Loading branch information
dcu committed Jan 29, 2024
1 parent ef91bb4 commit d9494e6
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions internal/object/scan.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"}
Expand Down

0 comments on commit d9494e6

Please sign in to comment.