You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
1.2 KiB
1.2 KiB
Create a function GenerateSectionData in main.go that generates data for the following type:
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:
- 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:
- SectionID should be a unique random string of 5 digits
- Course Number should be a unique string which is a random upper-case letter followed by 3 digits
- Instructor should be a random selection form the instructor_names list
- CourseTitle should be a brianvoe/gofaker BookTitle
- CourseType should be a random member of the globally-defined course_type list