MCPcopy Create free account
hub / github.com/MMadmer/EpicAssetsNotifyBot / deadlineFromMap

Function deadlineFromMap

internal/model/normalize.go:300–332  ·  view source on GitHub ↗
(payload map[string]any)

Source from the content-addressed store, hash-verified

298}
299
300func deadlineFromMap(payload map[string]any) (DeadlineInfo, bool) {
301 required := []string{"day", "month", "year", "hour", "minute"}
302 info := DeadlineInfo{}
303 for _, key := range required {
304 raw, ok := payload[key]
305 if !ok {
306 return DeadlineInfo{}, false
307 }
308 value, ok := asInt64(raw)
309 if !ok {
310 return DeadlineInfo{}, false
311 }
312 switch key {
313 case "day":
314 info.Day = int(value)
315 case "month":
316 info.Month = int(value)
317 case "year":
318 info.Year = int(value)
319 case "hour":
320 info.Hour = int(value)
321 case "minute":
322 info.Minute = int(value)
323 }
324 }
325
326 gmtOffset, ok := payload["gmt_offset"].(string)
327 if !ok || strings.TrimSpace(gmtOffset) == "" {
328 return DeadlineInfo{}, false
329 }
330 info.GMTOffset = gmtOffset
331 return info, true
332}

Callers 1

NormalizeDeadlineMethod · 0.85

Calls 1

asInt64Function · 0.85

Tested by

no test coverage detected