add section data generator
parent
b17c382c37
commit
305ce56989
@ -0,0 +1,27 @@
|
|||||||
|
Create a function GenerateSectionData in main.go that generates data for the following type:
|
||||||
|
|
||||||
|
```go
|
||||||
|
type Section struct {
|
||||||
|
SectionID string `json:"section_id"`
|
||||||
|
CourseNumber string `json:"course_number"`
|
||||||
|
Instructor string `json:"course_instructor"`
|
||||||
|
CourseTitle string `json:"course_title"`
|
||||||
|
CourseType string `json:"course_type"`
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
The function should take a config argument of type Config
|
||||||
|
|
||||||
|
It should generate a list of []string called instructor_names equal in length to the NumberOfInstructors member of config meeting the following requirements:
|
||||||
|
|
||||||
|
1. Each member should be a unique string which is a concatentaion of a brianvoe/gofaker LastName, a comma and a random uppercase letter
|
||||||
|
|
||||||
|
It should generate a list of []Section equal to the NumberOfSection member of config meeting the following requirements:
|
||||||
|
|
||||||
|
1. SectionID should be a unique random string of 5 digits
|
||||||
|
1. Course Number should be a unique string which is a random upper-case letter followed by 3 digits
|
||||||
|
1. Instructor should be a random selection form the instructor_names list
|
||||||
|
1. CourseTitle should be a brianvoe/gofaker BookTitle
|
||||||
|
1. CourseType should be a random member of the globally-defined course_type list
|
||||||
|
|
||||||
|
|
||||||
Loading…
Reference in New Issue