qrcode

package
v0.33.1 Latest Latest
Warning

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

Go to latest
Published: Nov 3, 2026 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	QRCodeStore = make(map[string]*StoredQRCode)
)

QRCodeStore 存储生成的二维码(内存存储)。 并发安全 + 容量上限:此前裸 map 无锁,两个并发 generate 即 concurrent map writes fatal 整个进程(未认证可达 = 远程 DoS)。

Functions

func GenerateQRCode

func GenerateQRCode(ctx context.Context, c *app.RequestContext)

GenerateQRCode . @router /qrcode/generate [POST]

func GetQRCode

func GetQRCode(ctx context.Context, c *app.RequestContext)

GetQRCode . @router /qrcode/:id [GET]

Types

type StoredQRCode

type StoredQRCode struct {
	ID      string
	Data    []byte
	DataStr string
	Size    int
	// Seq 插入序号(单调递增)⇒ 容量超限时确定地淘汰最早写入的条目
	Seq uint64
}

StoredQRCode 存储的二维码数据

Jump to

Keyboard shortcuts

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