Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type EncodeReq ¶
type EncodeReq struct { Content string `json:",omitempty"` Level RecoveryLevel `json:",omitempty"` // 冗余比例,默认 Highest PngSize int `json:",omitempty"` // 输出的png的长宽,会输出一个正方形的图形,所以长宽都一样。 默认 256 IsOutputDataUrl bool `json:",omitempty"` // 输出Data url,(就不输出 png了) MemoryCacher *EncodeV2Cacher `json:"-"` // 在进程内存中缓存生成qrcode的请求和结果。以便下次可以快速使用。 CacheKey string `json:",omitempty"` PngUseBufferPool bool `json:",omitempty"` // 是否使用 UsePngBufferPool,这个东西可以减少alloc,但是会产生一个一直不释放的内存占用 PngCompressionLevel png.CompressionLevel `json:",omitempty"` }
type EncodeResp ¶
func MustEncode ¶
func MustEncode(req EncodeReq) (resp EncodeResp)
type EncodeV2Cacher ¶
type EncodeV2Cacher struct { MaxCacheSize int // 默认 1000,创建之后不要修改。 // contains filtered or unexported fields }
func (*EncodeV2Cacher) GetByKey ¶
func (c *EncodeV2Cacher) GetByKey(key string) (resp EncodeResp, ok bool)
func (*EncodeV2Cacher) SetByKey ¶
func (c *EncodeV2Cacher) SetByKey(key string, resp EncodeResp)
type RecoveryLevel ¶
type RecoveryLevel int
Error detection/recovery capacity.
There are several levels of error detection/recovery capacity. Higher levels of error recovery are able to correct more errors, with the trade-off of increased symbol size.
const ( // Level L: 7% error recovery. Low RecoveryLevel = 1 // Level M: 15% error recovery. Good default choice. Medium RecoveryLevel = 2 // Level Q: 25% error recovery. High RecoveryLevel = 3 // Level H: 30% error recovery. Highest RecoveryLevel = 4 )
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
Package bitset implements an append only bit array.
|
Package bitset implements an append only bit array. |
Package reedsolomon provides error correction encoding for QR Code 2005.
|
Package reedsolomon provides error correction encoding for QR Code 2005. |
Click to show internal directories.
Click to hide internal directories.