/
fake.go
44 lines (34 loc) · 859 Bytes
/
fake.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
package fakes
import (
"math"
"time"
"github.com/verygoodsoftwarenotvirus/starter/internal/identifiers"
fake "github.com/brianvoe/gofakeit/v7"
)
func init() {
if err := fake.Seed(time.Now().UnixNano()); err != nil {
panic(err)
}
}
const (
exampleQuantity = 3
)
// BuildFakeID builds a fake ID.
func BuildFakeID() string {
return identifiers.New()
}
// BuildFakeTime builds a fake time.
func BuildFakeTime() time.Time {
return fake.Date().Add(0).Truncate(time.Second).UTC()
}
func buildFakeNumber() float64 {
return math.Round(float64((fake.Number(101, math.MaxInt8-1) * 100) / 100))
}
// buildUniqueString builds a fake string.
func buildUniqueString() string {
return fake.LoremIpsumSentence(7)
}
// buildFakePassword builds a fake password.
func buildFakePassword() string {
return fake.Password(true, true, true, true, false, 32)
}