package anilist import ( "reflect" "time" ) func addValue2InterfaceMap[K, T comparable](m map[K]interface{}, key K, value T) { if value != *new(T) { if reflect.TypeOf(new(T)).Elem() == reflect.TypeOf(new(time.Time)).Elem() { var t interface{} = value m[key] = t.(time.Time).Unix() return } m[key] = value } } func addSlice2InterfaceMap[K, T comparable](m map[K]interface{}, key K, value []T) { if len(value) > 0 { m[key] = value } }