gin_demo/event/event.go
2026-03-27 10:42:46 +08:00

28 lines
591 B
Go
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

package event
import "time"
// Event 是事件契约的公共接口。
// 不同模块只依赖事件类型和字段,不依赖具体实现。
type Event interface {
Type() string
}
const (
EventJWTTokenIssueRequested = "jwt.token.issue_requested"
)
// TokenIssueRequested 让 JWT 模块签发 token通过 Reply 通道返回)。
type TokenIssueRequested struct {
At time.Time
Username string
Reply chan TokenIssueResult
}
func (e TokenIssueRequested) Type() string { return EventJWTTokenIssueRequested }
type TokenIssueResult struct {
Token string
Err string
}