idempotent

package module
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2021 License: MIT Imports: 11 Imported by: 0

README

idempotent

idempotent checking for golang

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FormateDate

func FormateDate(t time.Time) string

Types

type DefaultIdempotentKey

type DefaultIdempotentKey struct {
	Target      interface{}
	Keys        FuncKeys
	KeysTmpl    string
	IgnoreError bool
	// contains filtered or unexported fields
}

func NewIdempotent

func NewIdempotent(keys string) (*DefaultIdempotentKey, error)

func (DefaultIdempotentKey) IdempotentKey

func (d DefaultIdempotentKey) IdempotentKey() (interface{}, error)

type FuncKeys

type FuncKeys func(obj interface{}) (interface{}, error)

type Idempotent

type Idempotent struct {
	Key     *DefaultIdempotentKey
	Service IdempotentService
}

func GetIdempotentWithKeys

func GetIdempotentWithKeys(keys string, service IdempotentService) (*Idempotent, error)

func (Idempotent) Duplicated

func (factory Idempotent) Duplicated(obj interface{}) (bool, error)

type IdempotentKey

type IdempotentKey interface {
	IdempotentKey() (interface{}, error)
}

IdempotentKey key interface

type IdempotentService

type IdempotentService interface {
	//Duplicated Idempotent checking, true if it's duplicated request.
	Duplicated(key interface{}) (bool, error)
	Save(key interface{}) error
}

IdempotentService Idempotent Service

type InMemoryMap

type InMemoryMap struct {
	// contains filtered or unexported fields
}

func NewInMemoryMap

func NewInMemoryMap() *InMemoryMap

func (*InMemoryMap) Duplicated

func (mem *InMemoryMap) Duplicated(key interface{}) (bool, error)

func (*InMemoryMap) Save

func (mem *InMemoryMap) Save(key interface{}) error

type PersistedIdempotent

type PersistedIdempotent struct {
	File     string `default:".idempotent.txt"`
	Batch    uint   `default:"100"`
	Interval string `default:"10s"`
	Retry    uint   `default:"3"`
	// contains filtered or unexported fields
}

func (*PersistedIdempotent) Duplicated

func (f *PersistedIdempotent) Duplicated(key interface{}) (bool, error)

func (*PersistedIdempotent) Init

func (f *PersistedIdempotent) Init() error

func (*PersistedIdempotent) Save

func (f *PersistedIdempotent) Save(key interface{}) error

Jump to

Keyboard shortcuts

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