-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfixtures.go
43 lines (35 loc) · 1.07 KB
/
fixtures.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
package users
import "github.com/akm/go-fixtures"
type Fixtures struct {
*fixtures.Fixtures[User]
}
var (
_ (fixtures.Factory[User]) = (*Fixtures)(nil)
_ (fixtures.Getter[User]) = (*Fixtures)(nil)
)
func NewFixtures() *Fixtures {
r := &Fixtures{}
r.Fixtures = fixtures.NewFixtures[User](r)
return r
}
func (f *Fixtures) NewRobPike(opts ...Option) *User {
return fixtures.NewWithDefaults(opts,
Name("Rob Pike"),
Email("[email protected]"),
)
}
func (f *Fixtures) NewKenThompson(opts ...Option) *User {
return fixtures.NewWithDefaults(opts,
Name("Ken Thompson"),
Email("[email protected]"),
)
}
func (f *Fixtures) NewRobertGriesemer(opts ...Option) *User {
return fixtures.NewWithDefaults(opts,
Name("Robert Griesemer"),
Email("[email protected]"),
)
}
func (f *Fixtures) RobPike(opts ...Option) *User { return f.Get("RobPike", opts...) }
func (f *Fixtures) KenThompson(opts ...Option) *User { return f.Get("KenThompson", opts...) }
func (f *Fixtures) RobertGriesemer(opts ...Option) *User { return f.Get("RobertGriesemer", opts...) }