tg/src/tx/action.go

38 lines
531 B
Go
Raw Normal View History

package tx
2023-07-09 01:28:59 +03:00
import (
"reflect"
)
// Jsonable Action.
type action struct {
Type string
Action Action
}
func newAction(a Action) *action {
typ, ok := actionMapByReflect[reflect.TypeOf(a)]
if !ok {
panic(ActionNotDefinedErr)
}
return &action{
Type: typ,
Action: a,
}
}
func (a *action) Act(c *Context) {
if a.Action != nil {
a.Action.Act(c)
}
}
2023-08-13 15:37:36 +03:00
// The argument for handling in channenl behaviours.
type ChannelContext struct {
2023-08-13 15:37:36 +03:00
}
type CC = ChannelContext
2023-08-13 15:37:36 +03:00
type ChannelAction struct {
Act (*ChannelContext)
}