Make hat selection a variable
This commit is contained in:
parent
df49dcb9ea
commit
a35901b976
@ -66,6 +66,9 @@ func HatQueryToHatQueryModel(q *pb.HatQuery) HatQuery {
|
||||
}
|
||||
|
||||
func (s *Server) MakeHat(ctx context.Context, size *pb.Size) (hat *pb.Hat, err error) {
|
||||
var colors []string = []string{"white", "black", "red", "blue", "white"}
|
||||
var names []string = []string{"bowler", "baseball cap", "top hat", "derby", "tricorne"}
|
||||
|
||||
st, _ := NewStore(s.DBPath, 0600, nil)
|
||||
defer st.Close()
|
||||
|
||||
@ -75,8 +78,8 @@ func (s *Server) MakeHat(ctx context.Context, size *pb.Size) (hat *pb.Hat, err e
|
||||
|
||||
h := Hat{
|
||||
Inches: size.Inches,
|
||||
Color: []string{"white", "black", "red", "blue"}[rand.Intn(4)],
|
||||
Name: []string{"bowler", "baseball cap", "top hat", "derby"}[rand.Intn(3)],
|
||||
Color: colors[rand.Intn(len(colors))],
|
||||
Name: names[rand.Intn(len(names))],
|
||||
}
|
||||
|
||||
fmt.Printf("made hat: %+v\n", h)
|
||||
|
Loading…
Reference in New Issue
Block a user