Skip to content

Commit e5c2c46

Browse files
pieternnfx
authored andcommitted
Use switch/case instead of if-elseif-else
1 parent 8df31d8 commit e5c2c46

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

sqlanalytics/resource_query.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,8 @@ func (q *QueryEntity) fromAPIObject(aq *api.Query, schema map[string]*schema.Sch
283283

284284
if s := aq.Schedule; s != nil {
285285
q.Schedule = &QuerySchedule{}
286-
if s.Interval%secondsInWeek == 0 {
286+
switch {
287+
case s.Interval%secondsInWeek == 0:
287288
q.Schedule.Weekly = &QueryScheduleWeekly{
288289
IntervalWeeks: s.Interval / secondsInWeek,
289290
}
@@ -296,7 +297,7 @@ func (q *QueryEntity) fromAPIObject(aq *api.Query, schema map[string]*schema.Sch
296297
if s.Until != nil {
297298
q.Schedule.Weekly.UntilDate = *s.Until
298299
}
299-
} else if s.Interval%secondsInDay == 0 {
300+
case s.Interval%secondsInDay == 0:
300301
q.Schedule.Daily = &QueryScheduleDaily{
301302
IntervalDays: s.Interval / secondsInDay,
302303
}
@@ -306,7 +307,7 @@ func (q *QueryEntity) fromAPIObject(aq *api.Query, schema map[string]*schema.Sch
306307
if s.Until != nil {
307308
q.Schedule.Daily.UntilDate = *s.Until
308309
}
309-
} else {
310+
default:
310311
q.Schedule.Continuous = &QueryScheduleContinuous{
311312
IntervalSeconds: s.Interval,
312313
}

0 commit comments

Comments
 (0)