testing any type for resturned structs
This commit is contained in:
4
lazy.go
4
lazy.go
@@ -42,7 +42,7 @@ type Config struct {
|
|||||||
type StructMock struct {
|
type StructMock struct {
|
||||||
Query string
|
Query string
|
||||||
Args []driver.Value
|
Args []driver.Value
|
||||||
MockStructs reflect.Value
|
MockStructs []any
|
||||||
Result driver.Result
|
Result driver.Result
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -158,7 +158,7 @@ func RandomStruct(c Config) (*StructMock, error) {
|
|||||||
return &StructMock{
|
return &StructMock{
|
||||||
Query: sqlx.Rebind(sqlx.AT, regexp.QuoteMeta(c.Query)),
|
Query: sqlx.Rebind(sqlx.AT, regexp.QuoteMeta(c.Query)),
|
||||||
Args: args,
|
Args: args,
|
||||||
MockStructs: filled,
|
MockStructs: reflect.ValueOf(filled).Interface().([]any),
|
||||||
Result: &sqlResult{
|
Result: &sqlResult{
|
||||||
rowsAffected: int64(c.RowCount),
|
rowsAffected: int64(c.RowCount),
|
||||||
err: nil,
|
err: nil,
|
||||||
|
Reference in New Issue
Block a user