draft/draft.go

21 lines
576 B
Go

package draft // import "git.fromouter.space/mcg/draft"
// PackProvider is a function that returns one or more packs, used for pods
type PackProvider func() []Pack
// PacksFromSet is a PackProvider for a set
func PacksFromSet(count int, set Set) PackProvider {
return PacksFromSchema(count, set.PackSchema())
}
// PacksFromSchema is a PackProvider for a schema
func PacksFromSchema(count int, schema PackSchema) PackProvider {
return func() []Pack {
packs := make([]Pack, count)
for i := range packs {
packs[i] = MakePackWithSchema(schema)
}
return packs
}
}