Help us shape the future of Go! Take the 2026 Go Developer Survey

quotalimit

package
v1.9.0 Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2026 License: MIT Imports: 1 Imported by: 0

Documentation

Overview

Package quotalimit lets a service consult Service Quotas applied values without importing it.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Func

type Func func(account, region, serviceCode, quotaCode string) (limit float64, ok bool)

Func returns the applied limit of a quota for an account and Region; ok is false when none is known.

type Gate

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

Gate holds the optional lookup; the zero value is ready to use and enforces nothing.

func (*Gate) Lookup

func (g *Gate) Lookup(account, region, serviceCode, quotaCode string) Limit

Lookup resolves the limit. Call it before taking a service lock: the lookup takes Service Quotas' own lock.

func (*Gate) Set

func (g *Gate) Set(f Func)

Set installs the lookup; nil disables enforcement.

type Limit

type Limit struct {
	Value float64
	Set   bool
}

Limit is a resolved quota limit; the zero value enforces nothing.

func (Limit) Reached

func (l Limit) Reached(current int) bool

Reached reports whether creating one more resource beyond current would exceed the limit.

Jump to

Keyboard shortcuts

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