Skip to content

Commit

Permalink
Added decode page result.
Browse files Browse the repository at this point in the history
  • Loading branch information
Gabriel Cataldo committed Jan 30, 2024
1 parent 509ee99 commit 9be8267
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions mongo/page.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,14 @@ type PageResult struct {
type pageContent []pageItemContent
type pageItemContent map[string]any

// Decode parse pageResult to dest param
func (p PageResult) Decode(dest any) error {
err := helper.ConvertToDest(p, dest)
return errors.NewSkipCaller(2, err)
}

// Decode parse pageResult.Content to dest param
func (p pageContent) Decode(dest any) error {
if helper.IsNotSlice(dest) {
return errors.NewSkipCaller(2, "mongo: dest is not a slice or array")
}
err := helper.ConvertToDest(p, dest)
return errors.NewSkipCaller(2, err)
}
Expand Down

0 comments on commit 9be8267

Please sign in to comment.