MCPcopy Create free account
hub / github.com/chanify/chanify / parseTimeContentStringItems

Function parseTimeContentStringItems

core/msgparam.go:278–304  ·  view source on GitHub ↗
(items map[string]string)

Source from the content-addressed store, hash-verified

276}
277
278func parseTimeContentStringItems(items map[string]string) []*model.MsgTimeItem {
279 lst := []*model.MsgTimeItem{}
280 for k, v := range items {
281 if strings.ContainsRune(v, '.') {
282 if vv, err := strconv.ParseFloat(v, 64); err == nil {
283 lst = append(lst, &model.MsgTimeItem{
284 Name: k,
285 Value: vv,
286 })
287 continue
288 }
289 } else {
290 if vv, err := strconv.ParseInt(v, 10, 64); err == nil {
291 lst = append(lst, &model.MsgTimeItem{
292 Name: k,
293 Value: vv,
294 })
295 continue
296 }
297 }
298 lst = append(lst, &model.MsgTimeItem{
299 Name: k,
300 Value: 0,
301 })
302 }
303 return lst
304}
305
306func parseTimestamp(t interface{}) *time.Time {
307 switch val := t.(type) {

Callers 2

ParseFormMethod · 0.85
tryFormMapFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected