Documentation ¶
Overview ¶
Package user is a watcher implement.
Index ¶
- Constants
- func NewActiveUserCallback(store store.Interface) fsm.Callback
- func NewDeleteUserCallback(store store.Interface) fsm.Callback
- func NewDisableUserCallback(store store.Interface) fsm.Callback
- func NewFSM(initial string, w *userWatcher) *fsm.FSM
- func NewUserEventAfterEvent(store store.Interface) fsm.Callback
- type UserStateMachine
Constants ¶
const (
UserEventAfterEvent = "after_event"
)
Variables ¶
This section is empty.
Functions ¶
func NewActiveUserCallback ¶
NewActiveUserCallback creates a callback function for the "active user" event in a finite state machine (FSM).
func NewDeleteUserCallback ¶
NewDeleteUserCallback creates a callback function for the "delete user" event in a finite state machine (FSM).
func NewDisableUserCallback ¶
NewDisableUserCallback creates a callback function for the "disable user" event in a finite state machine (FSM).
func NewFSM ¶
NewFSM creates a new finite state machine (FSM) for managing user states. The function takes an initial user status and a user watcher as input parameters. The FSM is configured with the following events and callbacks:
Events: - UserStatusRegistered -> UserStatusActived - UserStatusBlacklisted -> UserStatusDisabled - UserStatusDisabled -> UserStatusDeleted
Callbacks: - UserStatusActived: Calls the NewActiveUserCallback function to handle the "active user" event. - UserStatusDisabled: Calls the NewDisableUserCallback function to handle the "disable user" event. - UserStatusDeleted: Calls the NewDeleteUserCallback function to handle the "delete user" event. - UserEventAfterEvent: Calls the NewUserEventAfterEvent function after any user-related event is handled.
The function returns the newly created FSM.