user

package
v0.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 2, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package user is a watcher implement.

Index

Constants

View Source
const (
	UserEventAfterEvent = "after_event"
)

Variables

This section is empty.

Functions

func NewActiveUserCallback

func NewActiveUserCallback(store store.Interface) fsm.Callback

NewActiveUserCallback creates a callback function for the "active user" event in a finite state machine (FSM).

func NewDeleteUserCallback

func NewDeleteUserCallback(store store.Interface) fsm.Callback

NewDeleteUserCallback creates a callback function for the "delete user" event in a finite state machine (FSM).

func NewDisableUserCallback

func NewDisableUserCallback(store store.Interface) fsm.Callback

NewDisableUserCallback creates a callback function for the "disable user" event in a finite state machine (FSM).

func NewFSM

func NewFSM(initial string, w *userWatcher) *fsm.FSM

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.

func NewUserEventAfterEvent

func NewUserEventAfterEvent(store store.Interface) fsm.Callback

NewUserEventAfterEvent creates a callback function that is executed after a user-related event is handled in a finite state machine (FSM).

Types

type UserStateMachine

type UserStateMachine struct {
	UserM *model.UserM
	FSM   *fsm.FSM
}

UserStateMachine is a struct that represents a user finite state machine.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL