Skip to content

Commit

Permalink
Add attention section in README.md (#13)
Browse files Browse the repository at this point in the history
  • Loading branch information
soranoba authored Apr 20, 2021
1 parent f25ea9d commit 27c5409
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -124,3 +124,8 @@ func getUsers(ctx echo.Context) error {
}
}
```

### Attentions

This library is only available for the kind of functions that the [Query callback](https://pkg.go.dev/gorm.io/[email protected]/callbacks#Query) is executed on.<br>
That is, it cannot be used with [Row](https://pkg.go.dev/gorm.io/[email protected]#DB.Row) or [Scan](https://pkg.go.dev/gorm.io/[email protected]#DB.Scan) <br>
4 changes: 3 additions & 1 deletion cursor.go
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,9 @@ func getCursorStringFromColumns(value reflect.Value, columns ...string) pbc.Curs
args := make([]interface{}, len(columns))
for i, column := range columns {
argValue := value.FieldByName(column)
if argValue.CanInterface() {
if !argValue.IsValid() {
panic("`" + column + "` field is not exist in " + value.Type().Name() + ".")
} else if argValue.CanInterface() {
args[i] = argValue.Interface()
} else {
args[i] = nil
Expand Down

0 comments on commit 27c5409

Please sign in to comment.