forked from neotoolkit/faker
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathaddress.go
More file actions
24 lines (22 loc) · 688 Bytes
/
address.go
File metadata and controls
24 lines (22 loc) · 688 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
package faker
// PostCode returns random post code
func (f *Faker) PostCode() string {
return PostCode(
WithRand(f.cfg.rand),
WithPostCodeFormats(f.cfg.postCodeFormats...),
)
}
// PostCode returns random post code
//
// faker.PostCode(
// faker.WithRand(rand.New(rand.NewSource(time.Now().Unix()))), // Rand instance
// faker.WithPostCodeFormats("****", "*****", "******") // Slice of post code format for RandomElement
// )
//
func PostCode(opts ...Option) string {
cfg := newConfig(opts...)
if len(cfg.postCodeFormats) == 0 {
WithPostCodeFormats("####", "#####", "######")(cfg)
}
return Numerify(RandomElement(cfg.postCodeFormats, opts...), opts...)
}