receiptstore

package
v0.0.0-...-803885c Latest Latest
Warning

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

Go to latest
Published: Mar 2, 2021 License: MIT Imports: 2 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ApplyToFilter

func ApplyToFilter(f Filter, conds []*notification.Condition) error

ApplyToFilter apply condiitons to filter.

Types

type Filter

type Filter interface {
	//FilterReceipt filter receipt with given context
	//Return if Receipt is valid
	FilterReceipt(r *notificationqueue.Receipt, ctx *notification.ConditionContext) (bool, error)
	//ApplyCondition apply search condition to filter
	//ErrConditionNotSupported should be returned if condition keyword is not supported
	ApplyCondition(cond *notification.Condition) error
}

type ReceiptStore

type ReceiptStore interface {
	//Open open store and return any error if raised
	Open() error
	//Close close store and return any error if raised
	Close() error
	//Save save given notificaiton to store.
	//Receipt with same notification id will be overwritten.
	Save(receipt *notificationqueue.Receipt) error
	//List list no more than count notifactions in store with given search conditions form start position .
	//Count should be greater than 0.
	//Found receipts and next list position iter will be returned.
	//Return largest id receipts if asc is false.
	List(condition []*notification.Condition, start string, asc bool, count int) (result []*notificationqueue.Receipt, iter string, err error)
	//Count count store with given search conditions
	Count(condition []*notification.Condition) (int, error)
	//SupportedConditions return supported condition keyword list
	SupportedConditions() ([]string, error)
	//RetentionDays log retention period in day.
	RetentionDays() (int, error)
	//Remove remove receipt by given notification id and return removed receipt.
	Remove(id string) (*notificationqueue.Receipt, error)
}

ReceiptStore receipt stroce interace

Jump to

Keyboard shortcuts

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