idempotence

package module
v0.0.0-...-6a6eb7d Latest Latest
Warning

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

Go to latest
Published: Mar 1, 2021 License: BSD-3-Clause Imports: 9 Imported by: 0

README

idempotence service

保证API的幂等性

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetTimestamp

func GetTimestamp() int64

func NewLogger

func NewLogger() *zap.SugaredLogger

Types

type Idempotence

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

func NewIdempotence

func NewIdempotence(storage IdempotenceStorage) Idempotence

func (Idempotence) Remove

func (ide Idempotence) Remove(key, group string) error

func (Idempotence) SaveIfAbsent

func (ide Idempotence) SaveIfAbsent(key, group string) error

type IdempotenceStorage

type IdempotenceStorage interface {
	SaveIfAbsent(key, group string) error
	Remove(key, group string) error
}

type Logger

type Logger interface {
	Debugw(msg string, keysAndValues ...interface{})
	Infow(msg string, keysAndValues ...interface{})
	Errorw(msg string, keysAndValues ...interface{})
}

type RedisIdempotenceStorage

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

func (RedisIdempotenceStorage) Remove

func (storage RedisIdempotenceStorage) Remove(key, group string) error

func (RedisIdempotenceStorage) SaveIfAbsent

func (storage RedisIdempotenceStorage) SaveIfAbsent(key, group string) error

type RedisIdempotenceStorageConfig

type RedisIdempotenceStorageConfig struct {
	IP       string
	Port     string
	DBNumber int
}

Jump to

Keyboard shortcuts

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