Files
lazy/cmd/main.go

47 lines
742 B
Go
Raw Normal View History

2026-01-15 22:53:05 -05:00
package main
import (
2026-01-16 15:59:44 -05:00
"database/sql"
2026-01-15 22:53:05 -05:00
"fmt"
2026-01-16 15:59:44 -05:00
"time"
2026-01-15 22:53:05 -05:00
"code.jakeyoungdev.com/go/lazy"
)
func main() {
2026-01-16 15:59:44 -05:00
type Test struct {
Timer sql.NullTime `db:"timer"`
TestTime time.Time `db:"times"`
}
2026-01-15 22:53:05 -05:00
// res, err := lazy.RandomStruct(lazy.StructConfig{
// Query: "insert into test (one, two) values (?, ?), (?, ?)",
// Example: test{},
// RowCount: 2,
// })
x, y := lazy.RandomGenerate(lazy.Config{
Query: "select * from table",
2026-01-16 15:59:44 -05:00
Example: Test{},
2026-01-15 22:53:05 -05:00
RowCount: 1,
})
if y != nil {
panic(y)
}
fmt.Printf("%+v", x)
// if err != nil {
// panic(err)
// }
// fmt.Println(res)
// t, ok := res.MockStructs[0].(test)
// if !ok {
// fmt.Println("errrrrrr")
// }
// fmt.Println(t.One)
// fmt.Println(t.Two)
}