Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var (
Container = &DuplicateCheckerContainer{}
)
Initialize a duplicate checker container singleton instance
Functions ¶
func InitializeDuplicateChecker ¶
InitializeDuplicateChecker initializes the current duplicate checker according to the config
Types ¶
type DuplicateChecker ¶
type DuplicateChecker interface {
Get(checkerType DuplicateCheckerType, uid int64, identification string) (bool, string)
Set(checkerType DuplicateCheckerType, uid int64, identification string, remark string)
}
DuplicateChecker is common duplicate checker interface
type DuplicateCheckerContainer ¶
type DuplicateCheckerContainer struct {
Current DuplicateChecker
}
DuplicateCheckerContainer contains the current duplicate checker
func (*DuplicateCheckerContainer) Get ¶
func (c *DuplicateCheckerContainer) Get(checkerType DuplicateCheckerType, uid int64, identification string) (bool, string)
Get returns whether the same submission has been processed and related remark by the current duplicate checker
func (*DuplicateCheckerContainer) Set ¶
func (c *DuplicateCheckerContainer) Set(checkerType DuplicateCheckerType, uid int64, identification string, remark string)
Set saves the identification and remark to in-memory cache by the current duplicate checker
type DuplicateCheckerType ¶
type DuplicateCheckerType uint8
DuplicateCheckerType represents duplicate checker type
const ( DUPLICATE_CHECKER_TYPE_DEFAULT DuplicateCheckerType = 0 DUPLICATE_CHECKER_TYPE_NEW_ACCOUNT DuplicateCheckerType = 1 DUPLICATE_CHECKER_TYPE_NEW_CATEGORY DuplicateCheckerType = 2 DUPLICATE_CHECKER_TYPE_NEW_TRANSACTION DuplicateCheckerType = 3 DUPLICATE_CHECKER_TYPE_NEW_TEMPLATE DuplicateCheckerType = 4 )
Types of uuid
type InMemoryDuplicateChecker ¶
type InMemoryDuplicateChecker struct {
// contains filtered or unexported fields
}
InMemoryDuplicateChecker represents in-memory duplicate checker
func NewInMemoryDuplicateChecker ¶
func NewInMemoryDuplicateChecker(config *settings.Config) (*InMemoryDuplicateChecker, error)
NewInMemoryDuplicateChecker returns a new in-memory duplicate checker
func (*InMemoryDuplicateChecker) Get ¶
func (c *InMemoryDuplicateChecker) Get(checkerType DuplicateCheckerType, uid int64, identification string) (bool, string)
Get returns whether the same submission has been processed and related remark
func (*InMemoryDuplicateChecker) Set ¶
func (c *InMemoryDuplicateChecker) Set(checkerType DuplicateCheckerType, uid int64, identification string, remark string)
Set saves the identification and remark to in-memory cache