events

package
v0.0.0-...-3534724 Latest Latest
Warning

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

Go to latest
Published: Dec 10, 2023 License: GPL-3.0 Imports: 17 Imported by: 0

README

What it does?

Brief example

e := &emitter.Emitter{}
go func(){
	<-e.Emit("change", 42) // wait for the event sent successfully
	<-e.Emit("change", 37)
	e.Off("*") // unsubscribe any listeners
}()

for event := range e.On("change") {
	// do something with event.Args
	println(event.Int(0)) // cast the first argument to int
}
// listener channel was closed

Constructor

emitter.New takes a uint as the first argument to indicate what buffer size should be used for listeners. It is also possible to change the buffer capacity during runtime using the following code: e.Cap = 10.

By default, the emitter uses one goroutine per listener to send an event. You can change that behavior from asynchronous to synchronous by passing emitter.Sync flag as shown here: e.Use("*", emitter.Sync). I recommend specifying middlewares(see below) for the emitter at the begining.

Wildcard

The package allows publications and subscriptions with wildcard. This feature is based on path.Match function.

Example:

go e.Emit("something:special", 42)
event := <-e.Once("*") // search any events
println(event.Int(0)) // will print 42

// or emit an event with wildcard path
go e.Emit("*", 37) // emmit for everyone
event := <-e.Once("something:special")
println(event.Int(0)) // will print 37

Note that the wildcard uses path.Match, but the lib does not return errors related to parsing for this is not the main feature. Please check the topic specifically via emitter.Test() function.

Middlewares

An important part of pubsub package is the predicates. It should be allowed to skip some events. Middlewares address this problem. The middleware is a function that takes a pointer to the Event as its first argument. A middleware is capable of doing the following items:

  1. It allows you to modify an event.
  2. It allows skipping the event emitting if needed.
  3. It also allows modification of the event's arguments.
  4. It allows you to specify the mode to describe how exactly an event should be emitted(see below).

There are two ways to add middleware into the event emitting flow:

  • via .On("event", middlewares...)
  • via .Use("event", middlewares...)

The first one add middlewares only for a particular listener, while the second one adds middlewares for all events with a given topic.

For example:

// use synchronous mode for all events, it also depends
// on the emitter capacity(buffered/unbuffered channels)
e.Use("*", emitter.Sync)
go e.Emit("something:special", 42)

// define predicate
event := <-e.Once("*", func(ev *emitter.Event){
	if ev.Int(0) == 42 {
	    // skip sending
		ev.Flags = ev.Flags | emitter.FlagVoid
	}
})
panic("will never happen")

Flags

Flags needs to describe how exactly the event should be emitted. The available options are listed here.

Every event(emitter.Event) has a field called.Flags that contains flags as a binary mask. Flags can be set only via middlewares(see above).

There are several predefined middlewares to set needed flags:

  • emitter.Once
  • emitter.Close
  • emitter.Void
  • emitter.Skip
  • emitter.Sync
  • emitter.Reset

You can chain the above flags as shown below:

e.Use("*", emitter.Void) // skip sending for any events
go e.Emit("surprise", 65536)
event := <-e.On("*", emitter.Reset, emitter.Sync, emitter.Once) // set custom flags for this listener
pintln(event.Int(0)) // prints 65536

Cancellation

Golang provides developers with a powerful control for its concurrency flow. We know the state of a channel and whether it would block a go routine or not. So, by using this language construct, we can discard any emitted event. It's a good practice to design your application with timeouts so that you cancel the operations if needed as shown below:

Assume you have time out to emit the events:

done := e.Emit("broadcast", "the", "event", "with", "timeout")

select {
case <-done:
	// so the sending is done
case <-time.After(timeout):
	// time is out, let's discard emitting
	close(done)
}

It's pretty useful to control any goroutines inside an emitter instance.

Callbacks-only usage

using the emitter in more traditional way is possible, as well. If you don't need the async mode or you very attentive to the application resources, then the recipe is to use an emitter with zero capacity or to use FlagVoid to skip sending into the listener channel and use middleware as callback:

e := &emitter.Emitter{}
e.Use("*", emitter.Void)

go e.Emit("change", "field", "value")
e.On("change", func(event *Event){
	// handle changes here
	field := event.String(0)
	value := event.String(1)
	// ...and so on
})

Groups

Group merges different listeners into one channel. Example:

e1 := &emitter.Emitter{}
e2 := &emitter.Emitter{}
e3 := &emitter.Emitter{}

g := &emitter.Group{Cap: 1}
g.Add(e1.On("first"), e2.On("second"), e3.On("third"))

for event := g.On() {
	// handle the event
	// event has field OriginalTopic and Topic
}

Also you can combine several groups into one.

Event

Event is a struct that contains event information. Also, th event has some helpers to cast various arguments into bool, string, float64, int by given argument index with an optional default value.

Example:


go e.Emit("*", "some string", 42, 37.0, true)
event := <-e.Once("*")

first := event.String(0)
second := event.Int(1)
third := event.Float(2)
fourth := event.Bool(3)

// use default value if not exists
dontExists := event.Int(10, 64)
// or use dafault value if type don't match
def := event.Int(0, 128)

// .. and so on

Documentation

Overview

Package events implements channel based pubsub pattern. The design goals are:

  • fully functional and safety
  • simple to understand and use
  • make the code readable, maintainable and minimalistic

Index

Constants

View Source
const (
	EventTicketCreated        = "OnTicketCreated"        // 工单创建成功 - PASS
	EventTicketUpdated        = "OnTicketUpdated"        // 工单修改成功 - PASS
	EventTicketRemoved        = "OnTicketRemoved"        // 工单删除成功 - PASS
	EventTicketExecuted       = "OnTicketExecuted"       // 工单执行成功
	EventTicketFailed         = "OnTicketFailed"         // 工单执行失败
	EventTicketScheduled      = "OnTicketScheduled"      // 工单预约成功
	EventTicketStatusPatched  = "OnTicketStatusPatched"  // 工单状态修改成功
	EventQueryCreated         = "OnQueryCreated"         // 创建执行查询 - PASS
	EventQueryAnalyzed        = "OnQueryAnalyzed"        // 查询分析成功 - PASS
	EventQueryRewrited        = "OnQueryRewrited"        // 查询重写成功 - PASS
	EventUserRegistered       = "OnUserReigstered"       // 用户注册成功 - PASS
	EventUserSignedIn         = "OnUserSignedIn"         // 用户登录成功 - PASS
	EventPasswordUpdated      = "OnPasswordUpdated"      // 用户修改密码成功 - PASS
	EventEmailUpdated         = "OnEmailUpdated"         // 用户修改账号成功 - PASS
	EventProfileUpdated       = "OnProfileUpdated"       // 用户修改个人资料成功 - PASS
	EventUserLogout           = "OnUserLogout"           // 用户退出登录 - PASS
	EventUserCreated          = "OnUserCreated"          // 用户创建成功 - PASS
	EventUserUpdated          = "OnUserUpdated"          // 用户更新成功 - PASS
	EventUserStatusPatched    = "OnUserStatusPatched"    // 用户状态修改成功 - PASS
	EventRuleValuesPatched    = "OnRuleValuesPatched"    // 规则取值修改成功 - PASS
	EventRuleBitwisePatched   = "OnRuleBitwisePatched"   // 规则执行标志修改成功 - PASS
	EventOptionValuePatched   = "OnOptionValuePatched"   // 系统选项修改成功 - PASS
	EventCommentCreated       = "OnCommentCreated"       // 添加审核意见成功 - PASS
	EventCronCancelled        = "OnCronCancelled"        // 计划任务取消成功
	EventClusterStatusPatched = "OnClusterStatusPatched" // 群集状态修改成功 - PASS
	EventClusterRemoved       = "OnClusterRemoved"       // 群集移除成功 - PASS
	EventClusterUpdated       = "OnClusterUpdated"       // 群集修改成功 - PASS
	EventClusterCreated       = "OnClusterCreated"       // 群集创建成功 - PASS
	EventReviewerGranted      = "OnReviewerGranted"      // 授权审核人成功 - PASS
	EventReviewerRevoked      = "OnReviewerRevoked"      // 收回审核人成功 - PASS
	EventClusterGranted       = "OnClusterGranted"       // 授权群集成功 - PASS
	EventClusterRevoked       = "OnClusterRevoked"       // 收回群集成功 - PASS
	EventRoleGranted          = "OnRoleGranted"          // 授权角色成功 - PASS
	EventRoleRevoked          = "OnRoleRevoked"          // 收回角色成功 - PASS
)

事件列表

Variables

This section is empty.

Functions

func Close

func Close(e *Event)

Close middleware sets FlagClose flag for an event

func ClusterCreatedLogWriter

func ClusterCreatedLogWriter(e *Event)

ClusterCreatedLogWriter 群集创建日志记录

func ClusterCreatedStatisticsUpdater

func ClusterCreatedStatisticsUpdater(e *Event)

ClusterCreatedStatisticsUpdater 群集创建统计更新

func ClusterGrantedLogWriter

func ClusterGrantedLogWriter(e *Event)

ClusterGrantedLogWriter 授权群集日志记录

func ClusterRemovedLogWriter

func ClusterRemovedLogWriter(e *Event)

ClusterRemovedLogWriter 群集移除日志记录

func ClusterRemovedStatisticsUpdater

func ClusterRemovedStatisticsUpdater(e *Event)

ClusterRemovedStatisticsUpdater 群集移除统计更新

func ClusterRevokedLogWriter

func ClusterRevokedLogWriter(e *Event)

ClusterRevokedLogWriter 收回群集日志记录

func ClusterStatusPatchedLogWriter

func ClusterStatusPatchedLogWriter(e *Event)

ClusterStatusPatchedLogWriter 群集状态更新日志记录

func ClusterUpdatedLogWriter

func ClusterUpdatedLogWriter(e *Event)

ClusterUpdatedLogWriter 群集更新日志记录

func CommentCreatedLogWriter

func CommentCreatedLogWriter(e *Event)

CommentCreatedLogWriter 审核意见添加成功日记记录

func CommentCreatedMailSender

func CommentCreatedMailSender(e *Event)

CommentCreatedMailSender 审核意见添加成功邮件通知

func CommentCreatedStatisticsUpdater

func CommentCreatedStatisticsUpdater(e *Event)

CommentCreatedStatisticsUpdater 审核意见添加成功统计更新

func CronCancelledLogWriter

func CronCancelledLogWriter(e *Event)

CronCancelledLogWriter 工单预约取消日志记录

func CronCancelledMailSender

func CronCancelledMailSender(e *Event)

CronCancelledMailSender 工单预约取消邮件通知

func EmailUpdatedLogWriter

func EmailUpdatedLogWriter(e *Event)

EmailUpdatedLogWriter 账号更新日志记录

func EmailUpdatedMailSender

func EmailUpdatedMailSender(e *Event)

EmailUpdatedMailSender 账号更新邮件通知

func Fire

func Fire(topic string, args interface{})

Fire 触发事件

func FireSync

func FireSync(topic string, args interface{})

FireSync 触发事件

func LogWriter

func LogWriter(userID uint, operation string) error

LogWriter 日志记录表操作

func MailSender

func MailSender(args MailSendArgs)

MailSender 邮件发送

func Once

func Once(e *Event)

Once middleware sets FlagOnce flag for an event

func OptionValuePatchedLogWriter

func OptionValuePatchedLogWriter(e *Event)

OptionValuePatchedLogWriter 系统选项更新日志记录

func PasswordUpdatedLogWriter

func PasswordUpdatedLogWriter(e *Event)

PasswordUpdatedLogWriter 密码更新日志记录

func PasswordUpdatedMailSender

func PasswordUpdatedMailSender(e *Event)

PasswordUpdatedMailSender 密码更新邮件通知

func ProfileUpdatedLogWriter

func ProfileUpdatedLogWriter(e *Event)

ProfileUpdatedLogWriter 用户信息更新日志记录

func ProfileUpdatedMailSender

func ProfileUpdatedMailSender(e *Event)

ProfileUpdatedMailSender 用户信息更新邮件通知

func QueryAnalyzedLogWriter

func QueryAnalyzedLogWriter(e *Event)

QueryAnalyzedLogWriter 查询分析的日志记录

func QueryAnalyzedStatisticsUpdater

func QueryAnalyzedStatisticsUpdater(e *Event)

QueryAnalyzedStatisticsUpdater 查询分析的统计更新

func QueryCreatedLogWriter

func QueryCreatedLogWriter(e *Event)

QueryCreatedLogWriter 创建查询的日志记录

func QueryCreatedStatisticsUpdater

func QueryCreatedStatisticsUpdater(e *Event)

QueryCreatedStatisticsUpdater 创建查询的统计更新

func QueryRewritedLogWriter

func QueryRewritedLogWriter(e *Event)

QueryRewritedLogWriter 查询重写的日志记录

func QueryRewritedStatisticsUpdater

func QueryRewritedStatisticsUpdater(e *Event)

QueryRewritedStatisticsUpdater 查询重写的统计更新

func Reset

func Reset(e *Event)

Reset middleware resets flags

func ReviewerGrantedLogWriter

func ReviewerGrantedLogWriter(e *Event)

ReviewerGrantedLogWriter 授权审核人日志记录

func ReviewerRevokedLogWriter

func ReviewerRevokedLogWriter(e *Event)

ReviewerRevokedLogWriter 收回审核人日志记录

func RoleGrantedLogWriter

func RoleGrantedLogWriter(e *Event)

RoleGrantedLogWriter 授权角色日志记录

func RoleRevokedLogWriter

func RoleRevokedLogWriter(e *Event)

RoleRevokedLogWriter 收回角色日志记录

func RuleBitwisePatchedLogWriter

func RuleBitwisePatchedLogWriter(e *Event)

RuleBitwisePatchedLogWriter 规则状态位更新成功日志记录

func RuleValuesPatchedLogWriter

func RuleValuesPatchedLogWriter(e *Event)

RuleValuesPatchedLogWriter 规则值更新成功日志记录

func Skip

func Skip(e *Event)

Skip middleware sets FlagSkip flag for an event

func Sync

func Sync(e *Event)

Sync middleware sets FlagSync flag for an event

func TicketCreatedLogWriter

func TicketCreatedLogWriter(e *Event)

TicketCreatedLogWriter 创建工单的日志记录

func TicketCreatedMailSender

func TicketCreatedMailSender(e *Event)

TicketCreatedMailSender 创建工单的邮件通知

func TicketCreatedStatisticUpdater

func TicketCreatedStatisticUpdater(e *Event)

TicketCreatedStatisticUpdater 创建工单的统计更新

func TicketExecutedLogWriter

func TicketExecutedLogWriter(e *Event)

TicketExecutedLogWriter 工单执行成功的日志记录

func TicketExecutedMailSender

func TicketExecutedMailSender(e *Event)

TicketExecutedMailSender 工单执行成功的邮件通知

func TicketFailedLogWriter

func TicketFailedLogWriter(e *Event)

TicketFailedLogWriter 工单执行失败的日志记录

func TicketFailedMailSender

func TicketFailedMailSender(e *Event)

TicketFailedMailSender 工单执行失败的邮件通知

func TicketRemovedLogWriter

func TicketRemovedLogWriter(e *Event)

TicketRemovedLogWriter 删除工单的日志记录

func TicketRemovedMailSender

func TicketRemovedMailSender(e *Event)

TicketRemovedMailSender 删除工单的邮件通知

func TicketRemovedStatisticsUpdater

func TicketRemovedStatisticsUpdater(e *Event)

TicketRemovedStatisticsUpdater 删除工单的统计更新

func TicketScheduledLogWriter

func TicketScheduledLogWriter(e *Event)

TicketScheduledLogWriter 工单预约成功的日志记录

func TicketScheduledMailSender

func TicketScheduledMailSender(e *Event)

TicketScheduledMailSender 工单预约成功的邮件通知

func TicketStatusPatchedLogWriter

func TicketStatusPatchedLogWriter(e *Event)

TicketStatusPatchedLogWriter 工单状态更新成功日志记录

func TicketStatusPatchedMailSender

func TicketStatusPatchedMailSender(e *Event)

TicketStatusPatchedMailSender 工单状态更新成功邮件通知

func TicketUpdatedLogWriter

func TicketUpdatedLogWriter(e *Event)

TicketUpdatedLogWriter 工单更新日志记录

func TicketUpdatedMailSender

func TicketUpdatedMailSender(e *Event)

TicketUpdatedMailSender 更新工单的邮件通知

func UpdateStatistics

func UpdateStatistics(group string, key string, value float64) error

UpdateStatistics 统计信息更新

func UserCreatedLogWriter

func UserCreatedLogWriter(e *Event)

UserCreatedLogWriter 用户创建成功日志记录

func UserCreatedMailSender

func UserCreatedMailSender(e *Event)

UserCreatedMailSender 用户创建成功邮件通知

func UserCreatedStatisticsUpdater

func UserCreatedStatisticsUpdater(e *Event)

UserCreatedStatisticsUpdater 用户创建成功统计更新

func UserLogoutLogWriter

func UserLogoutLogWriter(e *Event)

UserLogoutLogWriter 用户退出登录日志记录

func UserRegisteredLogWriter

func UserRegisteredLogWriter(e *Event)

UserRegisteredLogWriter 用户注册的日志记录

func UserRegisteredMailSender

func UserRegisteredMailSender(e *Event)

UserRegisteredMailSender 用户注册的邮件通知(激活)

func UserRegisteredStatisticsUpdater

func UserRegisteredStatisticsUpdater(e *Event)

UserRegisteredStatisticsUpdater 用户注册的统计更新

func UserSignedInLogWriter

func UserSignedInLogWriter(e *Event)

UserSignedInLogWriter 用户登录的日志记录

func UserSignedInStatisticsUpdater

func UserSignedInStatisticsUpdater(e *Event)

UserSignedInStatisticsUpdater 用户登录的统计更新

func UserStatusPatchedLogWriter

func UserStatusPatchedLogWriter(e *Event)

UserStatusPatchedLogWriter 用户状态更新成功日志记录

func UserUpdatedLogWriter

func UserUpdatedLogWriter(e *Event)

UserUpdatedLogWriter 用户更新成功日志记录

func Void

func Void(e *Event)

Void middleware sets FlagVoid flag for an event

Types

type ClusterCreatedArgs

type ClusterCreatedArgs struct {
	Manager models.User
	Cluster models.Cluster
}

ClusterCreatedArgs 群集创建事件参数

type ClusterGrantedArgs

type ClusterGrantedArgs struct {
	Manager models.User
	User    models.User
}

ClusterGrantedArgs 授权群集事件参数

type ClusterRemovedArgs

type ClusterRemovedArgs struct {
	Manager models.User
	Cluster models.Cluster
}

ClusterRemovedArgs 群集移除事件参数

type ClusterRevokedArgs

type ClusterRevokedArgs struct {
	Manager models.User
	User    models.User
}

ClusterRevokedArgs 收回群集事件参数

type ClusterStatusPatchedArgs

type ClusterStatusPatchedArgs struct {
	Manager models.User
	Cluster models.Cluster
}

ClusterStatusPatchedArgs 群集状态更新事件参数

type ClusterUpdatedArgs

type ClusterUpdatedArgs struct {
	Manager models.User
	Cluster models.Cluster
}

ClusterUpdatedArgs 群集更新事件参数

type CommentCreatedArgs

type CommentCreatedArgs struct {
	User    models.User
	Ticket  models.Ticket
	Comment models.Comment
}

CommentCreatedArgs 审核意见添加成功事件参数

type CronCancelledArgs

type CronCancelledArgs struct {
	User   models.User
	Ticket models.Ticket
	Cron   models.Cron
}

CronCancelledArgs 工单预约取消事件参数

type EmailUpdatedArgs

type EmailUpdatedArgs struct {
	User  models.User
	Email string
}

EmailUpdatedArgs 账号更新成功事件参数

type Emitter

type Emitter struct {
	Cap uint

	Matcher Matcher
	// contains filtered or unexported fields
}

Emitter is a struct that allows to emit, receive event, close receiver channel, get info about topics and listeners

func New

func New(capacity uint, matcher Matcher) *Emitter

New returns just created Emitter struct. Capacity argument will be used to create channels with given capacity optionally include a matcher to use or nil to use the default which implements path.Match() from the system library

func (*Emitter) Emit

func (e *Emitter) Emit(topic string, args interface{}) chan struct{}

Emit emits an event with the rest arguments to all listeners which were covered by topic(it can be pattern).

func (*Emitter) Listeners

func (e *Emitter) Listeners(topic string) []<-chan Event

Listeners returns slice of listeners which were covered by topic(it can be pattern) and error if pattern is invalid.

func (*Emitter) Off

func (e *Emitter) Off(topic string, channels ...<-chan Event)

Off unsubscribes all listeners which were covered by topic, it can be pattern as well.

func (*Emitter) On

func (e *Emitter) On(topic string, middlewares ...func(*Event)) <-chan Event

On returns a channel that will receive events. As optional second argument it takes middlewares.

func (*Emitter) Once

func (e *Emitter) Once(topic string, middlewares ...func(*Event)) <-chan Event

Once works exactly like On(see above) but with `Once` as the first middleware.

func (*Emitter) Topics

func (e *Emitter) Topics() []string

Topics returns all existing topics.

func (*Emitter) Use

func (e *Emitter) Use(pattern string, middlewares ...func(*Event))

Use registers middlewares for the pattern.

type Event

type Event struct {
	Topic, OriginalTopic string
	Flags                Flag
	Args                 interface{}
}

Event is a structure to send events contains some helpers to cast primitive types easily.

type Flag

type Flag int

Flag used to describe what behavior do you expect.

const (
	// FlagReset only to clear previously defined flags.
	// Example:
	// ee.Use("*", Reset) // clears flags for this pattern
	FlagReset Flag = 0
	// FlagOnce indicates to remove the listener after first sending.
	FlagOnce Flag = 1 << iota
	// FlagVoid indicates to skip sending.
	FlagVoid
	// FlagSkip indicates to skip sending if channel is blocked.
	FlagSkip
	// FlagClose indicates to drop listener if channel is blocked.
	FlagClose
	// FlagSync indicates to send an event synchronously.
	FlagSync
)

type Group

type Group struct {
	// Cap is capacity to create new channel
	Cap uint
	// contains filtered or unexported fields
}

Group marges given subscribed channels into on subscribed channel

func (*Group) Add

func (g *Group) Add(channels ...<-chan Event)

Add adds channels which were already subscribed to some events.

func (*Group) Flush

func (g *Group) Flush()

Flush reset the group to the initial state. All references will dropped.

func (*Group) Off

func (g *Group) Off(channels ...<-chan Event)

Off unsubscribed given channels if any or unsubscribed all channels in other case

func (*Group) On

func (g *Group) On() <-chan Event

On returns subscribed channel.

type MailSendArgs

type MailSendArgs struct {
	To      mail.Address
	Subject string
	Body    string
}

MailSendArgs 邮件发送事件参数

type Matcher

type Matcher interface {
	Match(pattern, name string) (matched bool, err error)
}

Matcher interface describes a pattern matcher that determines if the name is included as a subset of the pattern returns true,nil upon success

func DefaultMatcher

func DefaultMatcher() Matcher

DefaultMatcher returns the standard Matcher (PathMatcher)

type OptionValuePatchedArgs

type OptionValuePatchedArgs struct {
	Manager models.User
	Option  models.Option
}

OptionValuePatchedArgs 系统选项更新事件参数

type PasswordUpdatedArgs

type PasswordUpdatedArgs struct {
	User models.User
}

PasswordUpdatedArgs 密码更新成功事件参数

type PathMatch

type PathMatch struct {
}

PathMatch is a Matcher implementation of the system path.Match function

func (*PathMatch) Match

func (p *PathMatch) Match(pattern, name string) (matched bool, err error)

Match path pattern match

type ProfileUpdatedArgs

type ProfileUpdatedArgs struct {
	User models.User
}

ProfileUpdatedArgs 用户信息更新成功事件参数

type QueryAnalyzedArgs

type QueryAnalyzedArgs struct {
	User  models.User
	Query models.Query
}

QueryAnalyzedArgs 查询分析成功事件参数

type QueryCreatedArgs

type QueryCreatedArgs struct {
	User  models.User
	Query models.Query
}

QueryCreatedArgs 查询创建成功事件参数

type QueryRewritedArgs

type QueryRewritedArgs struct {
	User  models.User
	Query models.Query
}

QueryRewritedArgs 查询分析成功事件参数

type ReviewerGrantedArgs

type ReviewerGrantedArgs struct {
	Manager models.User
	User    models.User
}

ReviewerGrantedArgs 授权审核人事件参数

type ReviewerRevokedArgs

type ReviewerRevokedArgs struct {
	Manager models.User
	User    models.User
}

ReviewerRevokedArgs 收回审核人事件参数

type RoleGrantedArgs

type RoleGrantedArgs struct {
	Manager models.User
	User    models.User
}

RoleGrantedArgs 授权角色事件参数

type RoleRevokedArgs

type RoleRevokedArgs struct {
	Manager models.User
	User    models.User
}

RoleRevokedArgs 收回角色事件参数

type RuleBitwisePatchedArgs

type RuleBitwisePatchedArgs struct {
	Manager models.User
	Rule    models.Rule
}

RuleBitwisePatchedArgs 规则状态位更新成功事件参数

type RuleValuesPatchedArgs

type RuleValuesPatchedArgs struct {
	Manager models.User
	Rule    models.Rule
}

RuleValuesPatchedArgs 规则值更新成功事件参数

type TicketCreatedArgs

type TicketCreatedArgs struct {
	User    models.User
	Ticket  models.Ticket
	Cluster models.Cluster
}

TicketCreatedArgs 工单创建成功事件参数

type TicketExecutedArgs

type TicketExecutedArgs struct {
	Ticket  models.Ticket
	Cluster models.Cluster
}

TicketExecutedArgs 工单执行成功事件参数

type TicketFailedArgs

type TicketFailedArgs struct {
	Ticket  models.Ticket
	Cluster models.Cluster
}

TicketFailedArgs 工单执行失败事件参数

type TicketRemovedArgs

type TicketRemovedArgs struct {
	User    models.User
	Ticket  models.Ticket
	Cluster models.Cluster
}

TicketRemovedArgs 工单删除成功事件参数

type TicketScheduledArgs

type TicketScheduledArgs struct {
	User    models.User
	Ticket  models.Ticket
	Cluster models.Cluster
	Cron    models.Cron
}

TicketScheduledArgs 工单预约成功事件参数

type TicketStatusPatchedArgs

type TicketStatusPatchedArgs struct {
	User    models.User
	Ticket  models.Ticket
	Cluster models.Cluster
}

TicketStatusPatchedArgs 工单状态更新成功事件参数

type TicketUpdatedArgs

type TicketUpdatedArgs struct {
	User    models.User
	Ticket  models.Ticket
	Cluster models.Cluster
}

TicketUpdatedArgs 工单更新成功事件参数

type UserCreatedArgs

type UserCreatedArgs struct {
	Manager models.User
	User    models.User
}

UserCreatedArgs 用户创建成功事件参数

type UserLogoutArgs

type UserLogoutArgs struct {
	User models.User
}

UserLogoutArgs 用户退出登录成功事件参数

type UserRegisteredArgs

type UserRegisteredArgs struct {
	User models.User
}

UserRegisteredArgs 用户注册成功事件参数

type UserSignedInArgs

type UserSignedInArgs struct {
	User models.User
	IP   string
}

UserSignedInArgs 用户登录成功事件参数

type UserStatusPatchedArgs

type UserStatusPatchedArgs struct {
	Manager models.User
	User    models.User
}

UserStatusPatchedArgs 用户状态更新成功事件参数

type UserUpdatedArgs

type UserUpdatedArgs struct {
	Manager models.User
	User    models.User
}

UserUpdatedArgs 用户更新成功事件参数

Jump to

Keyboard shortcuts

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