user

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Jul 18, 2025 License: MIT Imports: 13 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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