package
1.2.4
Repository: https://github.com/ccheers/xpkg.git
Documentation: pkg.go.dev

# README

ratelimit

import "github.com/ccheers/xpkg/ratelimit"

Index

type Allow

Allow allow options.

type Allow struct{}

func DefaultAllowOpts

func DefaultAllowOpts() Allow

DefaultAllowOpts returns the default allow options.

type AllowOption

AllowOption some option of Allow

type AllowOption interface {
    Apply(*Allow)
}

type DoneInfo

DoneInfo done info.

type DoneInfo struct {
    Err error
    Op  Op
}

type Limiter

Limiter limit interface.

type Limiter interface {
    Allow(ctx context.Context, opts ...AllowOption) (func(info DoneInfo), error)
}

type Op

Op operations type.

type Op int
const (
    // Success opertion type: success
    Success Op  = iota
    // Ignore opertion type: ignore
    Ignore
    // Drop opertion type: drop
    Drop
)

Generated by gomarkdoc

# Packages

No description provided by the author

# Functions

DefaultAllowOpts returns the default allow options.

# Constants

Drop opertion type: drop.
Ignore opertion type: ignore.
Success opertion type: success.

# Structs

Allow allow options.
DoneInfo done info.

# Interfaces

AllowOption some option of Allow.
Limiter limit interface.

# Type aliases

Op operations type.