2023-08-19 09:12:26 +03:00
|
|
|
package tg
|
2023-08-16 17:25:56 +03:00
|
|
|
|
|
|
|
import (
|
2023-09-21 20:32:24 +03:00
|
|
|
//"encoding/json"
|
|
|
|
//"reflect"
|
2023-08-16 17:25:56 +03:00
|
|
|
)
|
|
|
|
|
2023-09-21 20:32:24 +03:00
|
|
|
/*func (a *action) UnmarshalJSON(data []byte) error {
|
2023-08-16 17:25:56 +03:00
|
|
|
var err error
|
|
|
|
m := make(map[string]any)
|
|
|
|
err = json.Unmarshal(data, &m)
|
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
|
|
|
|
bts, err := json.Marshal(m["Action"])
|
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
|
|
|
|
a.Type = m["Type"].(string)
|
|
|
|
typ := actionMapByTypeName[a.Type].(reflect.Type)
|
|
|
|
if typ.Kind() == reflect.Pointer {
|
|
|
|
typ = typ.Elem()
|
|
|
|
}
|
|
|
|
vr := reflect.New(typ).Interface().(Action)
|
|
|
|
err = json.Unmarshal(bts, vr)
|
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
|
|
|
|
a.Action = vr
|
|
|
|
return nil
|
2023-09-21 20:32:24 +03:00
|
|
|
}*/
|