-
Notifications
You must be signed in to change notification settings - Fork 0
/
LibraryTestBase.go
53 lines (41 loc) · 1.2 KB
/
LibraryTestBase.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
45
46
47
48
49
50
package library
import (
"github.com/go-ee/schkola/person"
"fmt"
"github.com/go-ee/utils"
"github.com/google/uuid"
"time"
)
func NewBooksByPropNames(count int) []*Book {
items := make([]*Book, count)
for i := 0; i < count; i++ {
items[i] = NewBookByPropNames(i)
}
return items
}
func NewBookByPropNames(intSalt int) (ret *Book) {
ret = NewBook()
ret.Title = fmt.Sprintf("Title %v", intSalt)
ret.Description = fmt.Sprintf("Description %v", intSalt)
ret.Language = fmt.Sprintf("Language %v", intSalt)
ret.ReleaseDate = utils.PtrTime(time.Now())
ret.Edition = fmt.Sprintf("Edition %v", intSalt)
ret.Category = fmt.Sprintf("Category %v", intSalt)
ret.Author = person.NewPersonNameByPropNames(intSalt)
ret.Location = NewLocationByPropNames(intSalt)
ret.Id = uuid.New()
return
}
func NewLocationsByPropNames(count int) []*Location {
items := make([]*Location, count)
for i := 0; i < count; i++ {
items[i] = NewLocationByPropNames(i)
}
return items
}
func NewLocationByPropNames(intSalt int) (ret *Location) {
ret = NewLocation()
ret.Shelf = fmt.Sprintf("Shelf %v", intSalt)
ret.Fold = fmt.Sprintf("Fold %v", intSalt)
return
}