Documentation ¶
Index ¶
- Constants
- Variables
- type AtSomeone
- type Callback
- type GroupConcernAtConfig
- func (g *GroupConcernAtConfig) CheckAtAll(ctype concern.Type) bool
- func (g *GroupConcernAtConfig) ClearAtSomeoneList(ctype concern.Type)
- func (g *GroupConcernAtConfig) GetAtSomeoneList(ctype concern.Type) []int64
- func (g *GroupConcernAtConfig) MergeAtSomeoneList(ctype concern.Type, ids []int64)
- func (g *GroupConcernAtConfig) RemoveAtSomeoneList(ctype concern.Type, ids []int64)
- func (g *GroupConcernAtConfig) SetAtSomeoneList(ctype concern.Type, ids []int64)
- type GroupConcernConfig
- func (d GroupConcernConfig) AtBeforeHook(notify concern.Notify) *HookResult
- func (d GroupConcernConfig) NewsFilterHook(notify concern.Notify) *HookResult
- func (d GroupConcernConfig) NotifyAfterCallback(notify concern.Notify, message *message.GroupMessage)
- func (d GroupConcernConfig) NotifyBeforeCallback(notify concern.Notify)
- func (d GroupConcernConfig) ShouldSendHook(notify concern.Notify) *HookResult
- func (g *GroupConcernConfig) ToString() string
- type GroupConcernFilterConfig
- type GroupConcernFilterConfigByText
- type GroupConcernFilterConfigByType
- type GroupConcernNotifyConfig
- type Hook
- type HookResult
- type KeySet
- type NotifyManager
- type StateManager
- func (c *StateManager) AddGroupConcern(groupCode int64, id interface{}, ctype concern.Type) (newCtype concern.Type, err error)
- func (c *StateManager) CheckAndSetAtAllMark(groupCode int64, id interface{}) (result bool)
- func (c *StateManager) CheckConcern(id interface{}, ctype concern.Type) error
- func (c *StateManager) CheckGroupConcern(groupCode int64, id interface{}, ctype concern.Type) error
- func (c *StateManager) EmitFreshCore(name string, fresher func(ctype concern.Type, id interface{}) error)
- func (c *StateManager) FreshAll()
- func (c *StateManager) FreshCheck(id interface{}, setTTL bool) (result bool, err error)
- func (c *StateManager) FreshIndex(groups ...int64)
- func (c *StateManager) GetConcern(id interface{}) (result concern.Type, err error)
- func (c *StateManager) GetGroupConcern(groupCode int64, id interface{}) (result concern.Type, err error)
- func (c *StateManager) GetGroupConcernConfig(groupCode int64, id interface{}) (concernConfig *GroupConcernConfig)
- func (c *StateManager) GroupTypeById(ids []interface{}, types []concern.Type) ([]interface{}, []concern.Type, error)
- func (c *StateManager) List(filter func(groupCode int64, id interface{}, p concern.Type) bool) (idGroups []int64, ids []interface{}, idTypes []concern.Type, err error)
- func (c *StateManager) ListByGroup(groupCode int64, filter func(id interface{}, p concern.Type) bool) (ids []interface{}, idTypes []concern.Type, err error)
- func (c *StateManager) ListIds() (ids []interface{}, err error)
- func (c *StateManager) OperateGroupConcernConfig(groupCode int64, id interface{}, ...) error
- func (c *StateManager) RemoveAllByGroupCode(groupCode int64) (keys []string, err error)
- func (c *StateManager) RemoveAllById(_id interface{}) (err error)
- func (c *StateManager) RemoveGroupConcern(groupCode int64, id interface{}, ctype concern.Type) (newCtype concern.Type, err error)
- func (c *StateManager) Start() error
- func (c *StateManager) Stop()
Constants ¶
View Source
const ( FilterTypeType = "type" FilterTypeNotType = "not_type" FilterTypeText = "text" )
Variables ¶
View Source
var ( ErrAlreadyExists = errors.New("already exists") ErrLengthMismatch = errors.New("length mismatch") )
View Source
var ErrEmitQNotInit = errors.New("emit queue not enabled")
View Source
var HookResultPass = &HookResult{ Pass: true, }
Functions ¶
This section is empty.
Types ¶
type GroupConcernAtConfig ¶ added in v0.0.10
type GroupConcernAtConfig struct { AtAll concern.Type `json:"at_all"` AtSomeone []*AtSomeone `json:"at_someone"` }
GroupConcernAtConfig @配置
func (*GroupConcernAtConfig) CheckAtAll ¶ added in v0.0.10
func (g *GroupConcernAtConfig) CheckAtAll(ctype concern.Type) bool
func (*GroupConcernAtConfig) ClearAtSomeoneList ¶ added in v0.0.13
func (g *GroupConcernAtConfig) ClearAtSomeoneList(ctype concern.Type)
func (*GroupConcernAtConfig) GetAtSomeoneList ¶ added in v0.0.10
func (g *GroupConcernAtConfig) GetAtSomeoneList(ctype concern.Type) []int64
func (*GroupConcernAtConfig) MergeAtSomeoneList ¶ added in v0.0.13
func (g *GroupConcernAtConfig) MergeAtSomeoneList(ctype concern.Type, ids []int64)
func (*GroupConcernAtConfig) RemoveAtSomeoneList ¶ added in v0.0.13
func (g *GroupConcernAtConfig) RemoveAtSomeoneList(ctype concern.Type, ids []int64)
func (*GroupConcernAtConfig) SetAtSomeoneList ¶ added in v0.0.13
func (g *GroupConcernAtConfig) SetAtSomeoneList(ctype concern.Type, ids []int64)
type GroupConcernConfig ¶ added in v0.0.10
type GroupConcernConfig struct { GroupConcernAt GroupConcernAtConfig `json:"group_concern_at"` GroupConcernNotify GroupConcernNotifyConfig `json:"group_concern_notify"` GroupConcernFilter GroupConcernFilterConfig `json:"group_concern_filter"` // contains filtered or unexported fields }
func NewGroupConcernConfigFromString ¶ added in v0.0.10
func NewGroupConcernConfigFromString(s string) (*GroupConcernConfig, error)
func (GroupConcernConfig) AtBeforeHook ¶ added in v0.0.13
func (d GroupConcernConfig) AtBeforeHook(notify concern.Notify) *HookResult
func (GroupConcernConfig) NewsFilterHook ¶ added in v0.0.14
func (d GroupConcernConfig) NewsFilterHook(notify concern.Notify) *HookResult
func (GroupConcernConfig) NotifyAfterCallback ¶ added in v0.0.20
func (d GroupConcernConfig) NotifyAfterCallback(notify concern.Notify, message *message.GroupMessage)
func (GroupConcernConfig) NotifyBeforeCallback ¶ added in v0.0.20
func (GroupConcernConfig) ShouldSendHook ¶ added in v0.0.13
func (d GroupConcernConfig) ShouldSendHook(notify concern.Notify) *HookResult
func (*GroupConcernConfig) ToString ¶ added in v0.0.10
func (g *GroupConcernConfig) ToString() string
type GroupConcernFilterConfig ¶ added in v0.0.14
GroupConcernFilterConfig 过滤器配置
func (*GroupConcernFilterConfig) Empty ¶ added in v0.0.14
func (g *GroupConcernFilterConfig) Empty() bool
func (*GroupConcernFilterConfig) GetFilterByText ¶ added in v0.0.14
func (c *GroupConcernFilterConfig) GetFilterByText() (*GroupConcernFilterConfigByText, error)
func (*GroupConcernFilterConfig) GetFilterByType ¶ added in v0.0.14
func (c *GroupConcernFilterConfig) GetFilterByType() (*GroupConcernFilterConfigByType, error)
type GroupConcernFilterConfigByText ¶ added in v0.0.14
type GroupConcernFilterConfigByText struct {
Text []string `json:"text"`
}
func (*GroupConcernFilterConfigByText) ToString ¶ added in v0.0.14
func (g *GroupConcernFilterConfigByText) ToString() string
type GroupConcernFilterConfigByType ¶ added in v0.0.14
type GroupConcernFilterConfigByType struct {
Type []string `json:"type"`
}
func (*GroupConcernFilterConfigByType) ToString ¶ added in v0.0.14
func (g *GroupConcernFilterConfigByType) ToString() string
type GroupConcernNotifyConfig ¶ added in v0.0.13
type GroupConcernNotifyConfig struct { TitleChangeNotify concern.Type `json:"title_change_notify"` OfflineNotify concern.Type `json:"offline_notify"` }
GroupConcernNotifyConfig 推送配置
func (*GroupConcernNotifyConfig) CheckOfflineNotify ¶ added in v0.0.13
func (g *GroupConcernNotifyConfig) CheckOfflineNotify(ctype concern.Type) bool
func (*GroupConcernNotifyConfig) CheckTitleChangeNotify ¶ added in v0.0.13
func (g *GroupConcernNotifyConfig) CheckTitleChangeNotify(ctype concern.Type) bool
type Hook ¶ added in v0.0.13
type Hook interface { NewsFilterHook(notify concern.Notify) *HookResult AtBeforeHook(notify concern.Notify) *HookResult ShouldSendHook(notify concern.Notify) *HookResult }
type HookResult ¶ added in v0.0.13
HookResult Pass是false的时候,要把具体失败的地方填入Reason
func (*HookResult) PassOrReason ¶ added in v0.0.13
func (h *HookResult) PassOrReason(pass bool, reason string)
type NotifyManager ¶ added in v0.0.20
type StateManager ¶
func NewStateManager ¶
func NewStateManager(keySet KeySet, useEmit bool) *StateManager
func (*StateManager) AddGroupConcern ¶
func (*StateManager) CheckAndSetAtAllMark ¶ added in v0.0.10
func (c *StateManager) CheckAndSetAtAllMark(groupCode int64, id interface{}) (result bool)
CheckAndSetAtAllMark 检查@全体标记是否过期,已过期返回true,并重置标记,否则返回false。 因为@全体有次数限制,并且较为恼人,故设置标记,两次@全体之间必须有间隔。
func (*StateManager) CheckConcern ¶
func (c *StateManager) CheckConcern(id interface{}, ctype concern.Type) error
func (*StateManager) CheckGroupConcern ¶
func (c *StateManager) CheckGroupConcern(groupCode int64, id interface{}, ctype concern.Type) error
func (*StateManager) EmitFreshCore ¶
func (c *StateManager) EmitFreshCore(name string, fresher func(ctype concern.Type, id interface{}) error)
func (*StateManager) FreshAll ¶
func (c *StateManager) FreshAll()
func (*StateManager) FreshCheck ¶
func (c *StateManager) FreshCheck(id interface{}, setTTL bool) (result bool, err error)
func (*StateManager) FreshIndex ¶
func (c *StateManager) FreshIndex(groups ...int64)
func (*StateManager) GetConcern ¶
func (c *StateManager) GetConcern(id interface{}) (result concern.Type, err error)
GetConcern return the concern.Type combined from all group for an id
func (*StateManager) GetGroupConcern ¶
func (c *StateManager) GetGroupConcern(groupCode int64, id interface{}) (result concern.Type, err error)
GetGroupConcern return the concern.Type in specific group for an id
func (*StateManager) GetGroupConcernConfig ¶ added in v0.0.10
func (c *StateManager) GetGroupConcernConfig(groupCode int64, id interface{}) (concernConfig *GroupConcernConfig)
GetGroupConcernConfig always return non-nil
func (*StateManager) GroupTypeById ¶
func (*StateManager) ListByGroup ¶
func (*StateManager) ListIds ¶ added in v0.0.8
func (c *StateManager) ListIds() (ids []interface{}, err error)
func (*StateManager) OperateGroupConcernConfig ¶ added in v0.0.10
func (c *StateManager) OperateGroupConcernConfig(groupCode int64, id interface{}, f func(concernConfig *GroupConcernConfig) bool) error
OperateGroupConcernConfig 在一个rw事务中获取GroupConcernConfig并交给函数,如果返回true,就保存GroupConcernConfig,否则就回滚。
func (*StateManager) RemoveAllByGroupCode ¶
func (c *StateManager) RemoveAllByGroupCode(groupCode int64) (keys []string, err error)
func (*StateManager) RemoveAllById ¶
func (c *StateManager) RemoveAllById(_id interface{}) (err error)
func (*StateManager) RemoveGroupConcern ¶
func (*StateManager) Start ¶
func (c *StateManager) Start() error
func (*StateManager) Stop ¶ added in v0.0.19
func (c *StateManager) Stop()
Click to show internal directories.
Click to hide internal directories.