MCPcopy Index your code
hub / github.com/coder/coder / BitmapToWeekdays

Function BitmapToWeekdays

codersdk/templates.go:104–127  ·  view source on GitHub ↗

BitmapToWeekdays converts a bitmap to a list of weekdays in accordance with the schedule package's rules (see above).

(bitmap uint8)

Source from the content-addressed store, hash-verified

102// BitmapToWeekdays converts a bitmap to a list of weekdays in accordance with
103// the schedule package's rules (see above).
104func BitmapToWeekdays(bitmap uint8) []string {
105 days := []string{}
106 for i := 0; i < 7; i++ {
107 if bitmap&(1<<i) != 0 {
108 switch i {
109 case 0:
110 days = append(days, "monday")
111 case 1:
112 days = append(days, "tuesday")
113 case 2:
114 days = append(days, "wednesday")
115 case 3:
116 days = append(days, "thursday")
117 case 4:
118 days = append(days, "friday")
119 case 5:
120 days = append(days, "saturday")
121 case 6:
122 days = append(days, "sunday")
123 }
124 }
125 }
126 return days
127}
128
129var AllDaysOfWeek = []string{"monday", "tuesday", "wednesday", "thursday", "friday", "saturday", "sunday"}
130

Callers 4

convertTemplateMethod · 0.92
ConvertTemplateFunction · 0.92
TestWorkspaceAutobuildFunction · 0.92

Calls

no outgoing calls

Tested by 1

TestWorkspaceAutobuildFunction · 0.74