1 Commits
v1.2.0 ... main

Author SHA1 Message Date
ff1854f640 readme update 2026-06-03 10:37:04 -04:00

View File

@@ -13,7 +13,7 @@ Lazy is a helper tool when working with [sqlx](https://github.com/jmoiron/sqlx)
<hr /> <hr />
## RandomGenerate ## 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 ```go
func RandomGenerate(m Config) (*Mock, error) func RandomGenerate(m Config) (*Mock, error)
``` ```
@@ -73,7 +73,8 @@ func ExampleTest() {
Query: "SELECT key, count FROM table WHERE key IN (?, ?)", Query: "SELECT key, count FROM table WHERE key IN (?, ?)",
Example: SqlResultsExample{}, Example: SqlResultsExample{},
Keys: []any{ 1, 6 }, Keys: []any{ 1, 6 },
RowCount: 2, RowCount: 2,
BindType: lazy.BindQuestion,
} }
mock, err := lazy.GenerateRandom(cfg) mock, err := lazy.GenerateRandom(cfg)
if err != nil { if err != nil {