Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| ff1854f640 |
@@ -13,7 +13,7 @@ Lazy is a helper tool when working with [sqlx](https://github.com/jmoiron/sqlx)
|
||||
<hr />
|
||||
|
||||
## RandomGenerate
|
||||
Generates random data for basic types and slices to be used with [sqlmock](https://github.com/DATA-DOG/go-sqlmock). Slices are given an arbitrary amount entries See [Mocks](#mocks) for more information.
|
||||
Generates random data for basic types and slices to be used with [sqlmock](https://github.com/DATA-DOG/go-sqlmock). Slices are given an arbitrary amount entries See [Mocks](#mocks) for more information. Lazy supports many bind types using sqlx's Rebind method, however, due to this conversion queries that use operators like postgres' jsonb "?" operator cannot be paired with the BindQuestion option as sqlx will greedily replace all "?" causing syntax errors
|
||||
```go
|
||||
func RandomGenerate(m Config) (*Mock, error)
|
||||
```
|
||||
@@ -74,6 +74,7 @@ func ExampleTest() {
|
||||
Example: SqlResultsExample{},
|
||||
Keys: []any{ 1, 6 },
|
||||
RowCount: 2,
|
||||
BindType: lazy.BindQuestion,
|
||||
}
|
||||
mock, err := lazy.GenerateRandom(cfg)
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user