Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add net/netip to random expr imports #328

Merged
merged 2 commits into from
Dec 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

- Fix random value generation for pq.Float64Array factory (thanks @felipeparaujo)
- Using the `UpdateMod()` and `DeleteMod()` methods on an empty model slice now appends `WHERE primary_key IN NULL` which will return no results. Instead of `WHERE primary_key IN ()` which is a syntax error.
- Ensure `net/netip` is imported for the `pgtypes.Inet` random expression (thanks @plunkettscott)

## [v0.29.0] - 2024-11-20

Expand Down
2 changes: 1 addition & 1 deletion gen/bobgen-helpers/helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ func Types() drivers.Types {
ipAddr := netip.AddrFrom4(addr)
ipPrefix := netip.PrefixFrom(ipAddr, f.IntBetween(0, ipAddr.BitLen()))
return pgtypes.Inet{Prefix: ipPrefix}`,
RandomExprImports: importers.List{`"crypto/rand"`},
RandomExprImports: importers.List{`"crypto/rand"`, `"net/netip"`},
},
"pgtypes.Macaddr": {
Imports: importers.List{`"github.com/stephenafamo/bob/types/pgtypes"`},
Expand Down
Loading