Documentation
¶
Overview ¶
Package qrcode provides a high-performance QR code generation library in pure Go with zero external dependencies. It supports encoding over 30 payload types including URLs, WiFi credentials, vCard contacts, calendar events, social media links, payments, and geographic locations. QR codes can be rendered to PNG, SVG, PDF, terminal Unicode blocks, or base64-encoded data URIs, with support for custom module shapes, gradient fills, transparency, and centered logo overlays.
The library exposes two primary usage patterns. The first is a functional-options Generator interface for long-lived, concurrent use:
gen, err := qrcode.New(
qrcode.WithErrorCorrection(qrcode.LevelH),
qrcode.WithDefaultSize(400),
qrcode.WithQuietZone(4),
)
if err != nil {
log.Fatal(err)
}
defer gen.Close(ctx)
payload := payload.URL("https://example.com")
qr, err := gen.Generate(ctx, payload)
The second is a fluent Builder API that chains configuration and provides one-shot convenience methods:
png, err := qrcode.NewBuilder().
ErrorCorrection(qrcode.LevelQ).
ForegroundColor("#1a1a2e").
BackgroundColor("#e0e0e0").
Quick("https://example.com", 512)
For fire-and-forget use cases, package-level Quick* functions create and discard a generator internally:
png, err := qrcode.Quick("Hello, world!")
svg, err := qrcode.QuickSVG("https://example.com")
err := qrcode.QuickFile("Hello, world!", "output.png")
Batch generation is available through both the Generator.Batch method and the dedicated batch.Processor type, which supports concurrency control, file output, and statistics collection.
Index ¶
- func ContextWithQR(ctx context.Context, gen Generator) context.Context
- func GenerateASCII(ctx context.Context, gen Generator, p payload.Payload) (string, error)
- func GenerateBase64(ctx context.Context, gen Generator, p payload.Payload) (string, error)
- func GeneratePNG(ctx context.Context, gen Generator, p payload.Payload) ([]byte, error)
- func GenerateSVG(ctx context.Context, gen Generator, p payload.Payload) (string, error)
- func Quick(data string, size ...int) ([]byte, error)
- func QuickContact(firstName, lastName, phone, email string, size ...int) ([]byte, error)
- func QuickEmail(to, subject, body string, size ...int) ([]byte, error)
- func QuickEvent(title, location string, start, end time.Time, size ...int) ([]byte, error)
- func QuickFile(data, path string, size ...int) error
- func QuickGeo(lat, lng float64, size ...int) ([]byte, error)
- func QuickPayment(username, amount string, size ...int) ([]byte, error)
- func QuickSMS(phone, message string, size ...int) ([]byte, error)
- func QuickSVG(data string, size ...int) (string, error)
- func QuickURL(url string, size ...int) ([]byte, error)
- func QuickWiFi(ssid, password, encryption string, size ...int) ([]byte, error)
- func Save(ctx context.Context, gen Generator, p payload.Payload, path string) error
- func SavePNG(ctx context.Context, gen Generator, p payload.Payload, path string) error
- func SaveSVG(ctx context.Context, gen Generator, p payload.Payload, path string) error
- type Builder
- func (b *Builder) AutoSize(auto bool) *Builder
- func (b *Builder) BackgroundColor(color string) *Builder
- func (b *Builder) Build() (Generator, error)
- func (b *Builder) BuildAndGeneratePNG(ctx context.Context, p payload.Payload) ([]byte, error)
- func (b *Builder) BuildAndGenerateSVG(ctx context.Context, p payload.Payload) (string, error)
- func (b *Builder) BuildAndSave(ctx context.Context, p payload.Payload, path string) error
- func (b *Builder) Clone() *Builder
- func (b *Builder) ErrorCorrection(level ErrorCorrectionLevel) *Builder
- func (b *Builder) ForegroundColor(color string) *Builder
- func (b *Builder) Format(f Format) *Builder
- func (b *Builder) Logo(source string, sizeRatio float64) *Builder
- func (b *Builder) LogoOverlay(enabled bool) *Builder
- func (b *Builder) LogoTint(color string) *Builder
- func (b *Builder) Margin(margin int) *Builder
- func (b *Builder) MaskPattern(pattern int) *Builder
- func (b *Builder) MaxVersion(v int) *Builder
- func (b *Builder) MinVersion(v int) *Builder
- func (b *Builder) MustBuild() Generator
- func (b *Builder) Options(opts ...Option) *Builder
- func (b *Builder) Prefix(prefix string) *Builder
- func (b *Builder) QueueSize(n int) *Builder
- func (b *Builder) Quick(data string, size ...int) ([]byte, error)
- func (b *Builder) QuickContact(firstName, lastName, phone, email string, size ...int) ([]byte, error)
- func (b *Builder) QuickEmail(to, subject, body string, size ...int) ([]byte, error)
- func (b *Builder) QuickEvent(title, location string, start, end time.Time, size ...int) ([]byte, error)
- func (b *Builder) QuickFile(data, path string, size ...int) error
- func (b *Builder) QuickGeo(lat, lng float64, size ...int) ([]byte, error)
- func (b *Builder) QuickSMS(phone, message string, size ...int) ([]byte, error)
- func (b *Builder) QuickSVG(data string, size ...int) (string, error)
- func (b *Builder) QuickURL(url string, size ...int) ([]byte, error)
- func (b *Builder) QuickWiFi(ssid, password, encryption string, size ...int) ([]byte, error)
- func (b *Builder) Size(size int) *Builder
- func (b *Builder) Version(v int) *Builder
- func (b *Builder) WorkerCount(n int) *Builder
- type Config
- type ErrorCorrectionLevel
- type Format
- type Generator
- type Option
- func WithAutoSize(auto bool) Option
- func WithBackgroundColor(color string) Option
- func WithConcurrency(n int) Option
- func WithDefaultFormat(f Format) Option
- func WithDefaultSize(size int) Option
- func WithErrorCorrection(level ErrorCorrectionLevel) Option
- func WithForegroundColor(color string) Option
- func WithLogo(logoSource string, sizeRatio float64) Option
- func WithLogoOverlay(enabled bool) Option
- func WithLogoTint(color string) Option
- func WithMaskPattern(pattern int) Option
- func WithMaxVersion(v int) Option
- func WithMinVersion(v int) Option
- func WithPrefix(prefix string) Option
- func WithQueueSize(n int) Option
- func WithQuietZone(zone int) Option
- func WithSlowOperation(d time.Duration) Option
- func WithVersion(v int) Option
- func WithWorkerCount(n int) Option
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ContextWithQR ¶
ContextWithQR stores a Generator in the given context using an unexported context key. The stored Generator can later be retrieved with QRFromContext. This is useful in HTTP middleware or request-scoped dependency injection.
func GenerateASCII ¶
GenerateASCII renders a QR code from the payload as Unicode block characters.
func GenerateBase64 ¶
GenerateBase64 renders a QR code from the payload as a base64-encoded PNG data URI.
func GeneratePNG ¶
GeneratePNG renders a QR code from the payload as PNG bytes.
func GenerateSVG ¶
GenerateSVG renders a QR code from the payload as an SVG string.
func QuickContact ¶
QuickContact generates a PNG QR code encoding a vCard contact.
func QuickEmail ¶
QuickEmail generates a PNG QR code encoding an email message.
func QuickEvent ¶
QuickEvent generates a PNG QR code encoding a calendar event.
func QuickFile ¶
QuickFile generates a QR code from the given text data and writes it to path. The output format is inferred from the file extension (.png, .svg, or .pdf).
func QuickPayment ¶
QuickPayment generates a PNG QR code encoding a PayPal payment link.
func QuickSVG ¶
QuickSVG generates an SVG QR code from the given text data with an optional image size.
func Save ¶
Save renders a QR code from the payload and writes it to the given file path. The output format is inferred from the file extension (.png, .svg, or .pdf).
Types ¶
type Builder ¶
type Builder struct {
// contains filtered or unexported fields
}
Builder provides a fluent API for constructing a Generator with chained configuration. Each setter method returns the Builder itself, allowing calls to be chained. The accumulated options are applied when Build or MustBuild is called.
Builder also provides one-shot convenience methods (Quick, QuickURL, QuickWiFi, etc.) that build a generator, render a single QR code, and immediately close the generator.
png, err := qrcode.NewBuilder().
ErrorCorrection(qrcode.LevelQ).
ForegroundColor("#1a1a2e").
BackgroundColor("#e0e0e0").
Size(512).
Quick("https://example.com")
For repeated use, call Build once and reuse the Generator:
gen, err := qrcode.NewBuilder().
ErrorCorrection(qrcode.LevelH).
QuietZone(4).
Build()
func NewBuilder ¶
func NewBuilder() *Builder
NewBuilder creates a new Builder with default settings.
func (*Builder) BackgroundColor ¶
BackgroundColor sets the background color.
func (*Builder) Build ¶
Build creates a Generator from the accumulated configuration. Returns an error if the combined options produce an invalid configuration.
func (*Builder) BuildAndGeneratePNG ¶
BuildAndGeneratePNG builds a generator and produces a PNG byte slice from the payload. The generator is closed after rendering. For repeated use, call Build once and use Generator.GenerateToWriter directly.
func (*Builder) BuildAndGenerateSVG ¶
BuildAndGenerateSVG builds a generator and produces an SVG string from the payload. The generator is closed after rendering.
func (*Builder) BuildAndSave ¶
BuildAndSave builds a generator and saves the rendered QR code to a file. The format is inferred from the file extension (.png, .svg, or .pdf). The generator is closed after saving.
func (*Builder) Clone ¶
Clone returns a shallow copy of the builder with the same options. The returned Builder can be modified independently. Used internally by convenience methods to avoid mutating the caller's Builder.
func (*Builder) ErrorCorrection ¶
func (b *Builder) ErrorCorrection(level ErrorCorrectionLevel) *Builder
ErrorCorrection sets the default error correction level.
func (*Builder) ForegroundColor ¶
ForegroundColor sets the foreground (module) color.
func (*Builder) Logo ¶
Logo configures a centered logo overlay with the given image source and size ratio.
func (*Builder) LogoOverlay ¶
LogoOverlay enables or disables the logo overlay.
func (*Builder) MaskPattern ¶
MaskPattern sets the mask pattern (0–7).
func (*Builder) MaxVersion ¶
MaxVersion sets the maximum QR code version.
func (*Builder) MinVersion ¶
MinVersion sets the minimum QR code version.
func (*Builder) MustBuild ¶
MustBuild is like Build but panics on error. Useful in short-lived programs where configuration errors should halt immediately.
gen := qrcode.NewBuilder().Size(512).MustBuild()
func (*Builder) Quick ¶
Quick generates a PNG QR code from the given text data. The optional size argument specifies the image width/height in pixels; defaults to 256.
func (*Builder) QuickContact ¶
func (b *Builder) QuickContact(firstName, lastName, phone, email string, size ...int) ([]byte, error)
QuickContact generates a PNG QR code encoding a vCard contact with the given name, phone, and email. Additional vCard fields can be set by using the payload.Contact builder and Builder.BuildAndGeneratePNG.
func (*Builder) QuickEmail ¶
QuickEmail generates a PNG QR code encoding an email message.
func (*Builder) QuickEvent ¶
func (b *Builder) QuickEvent(title, location string, start, end time.Time, size ...int) ([]byte, error)
QuickEvent generates a PNG QR code encoding a calendar event (iCalendar VEVENT).
func (*Builder) QuickFile ¶
QuickFile generates a QR code from the given text data and writes it to the specified file path. The output format is inferred from the file extension (.png, .svg, or .pdf).
func (*Builder) QuickGeo ¶
QuickGeo generates a PNG QR code encoding a geographic location (geo: URI).
func (*Builder) QuickSVG ¶
QuickSVG generates an SVG QR code from the given text data. The optional size argument specifies the image width/height in pixels; defaults to 256.
func (*Builder) QuickWiFi ¶
QuickWiFi generates a PNG QR code encoding a WiFi network configuration. The encryption parameter should be one of the payload.Encryption* constants.
func (*Builder) WorkerCount ¶
WorkerCount sets the number of concurrent batch workers.
type Config ¶
type Config struct {
DefaultVersion int `json:"default_version"` // QR version (1–40); 0 means auto-select
DefaultECLevel string `json:"default_ec_level"` // Error correction: "L", "M", "Q", "H"
MinVersion int `json:"min_version"` // Minimum version for auto-selection (1–40)
MaxVersion int `json:"max_version"` // Maximum version for auto-selection (1–40)
AutoSize bool `json:"auto_size"` // Enable automatic version sizing by data length
WorkerCount int `json:"worker_count"` // Concurrent goroutines for batch operations (1–64)
QueueSize int `json:"queue_size"` // Internal work queue capacity (>=1)
DefaultFormat string `json:"default_format"` // Default render format: "png", "svg", "terminal", "pdf"
DefaultSize int `json:"default_size"` // Default image width/height in pixels (100–4000)
QuietZone int `json:"quiet_zone"` // Quiet-zone margin modules around the QR code (0–20)
ForegroundColor string `json:"foreground_color"` // Hex color for dark modules (e.g. "#000000")
BackgroundColor string `json:"background_color"` // Hex color for light modules (e.g. "#FFFFFF")
MaskPattern int `json:"mask_pattern"` // Data mask pattern (0–7, or -1 for auto)
LogoSource string `json:"logo_source"` // File path or URL of the overlay logo image
LogoSizeRatio float64 `json:"logo_size_ratio"` // Fraction of QR image occupied by logo (0.05–0.4)
LogoOverlay bool `json:"logo_overlay"` // Whether to render the logo overlay
LogoTint string `json:"logo_tint"` // Hex color to tint the logo image
Prefix string `json:"prefix"` // URI prefix prepended to encoded data
SlowOperation time.Duration `json:"slow_operation"` // Threshold for logging slow generations
}
Config holds all configuration parameters for the QR code generator. Config is typically constructed implicitly through functional Option values passed to New or NewBuilder, but can also be manipulated directly for advanced use cases such as merging presets.
The zero-value Config is not valid; use defaultConfig (via New) to obtain a Config with sensible defaults, then apply Option overrides.
cfg := qrcode.defaultConfig() // internal; use qrcode.New() instead qrcode.WithErrorCorrection(qrcode.LevelH)(cfg)
func (*Config) Clone ¶
Clone returns a shallow copy of the configuration. The returned Config can be modified independently without affecting the original. This is used internally to snapshot the configuration under a read lock before applying per-call options.
func (*Config) Merge ¶
Merge overlays non-zero fields from other into c. Fields that are their zero value in other are left unchanged in c. This is useful for applying a partial configuration preset on top of a base configuration.
base := defaultConfig()
preset := &Config{DefaultSize: 512, ForegroundColor: "#1a1a2e"}
base.Merge(preset)
func (*Config) Validate ¶
Validate checks that all configuration fields are within valid ranges and returns an error describing the first violation found. Checked constraints include: MinVersion <= MaxVersion, DefaultVersion within range, WorkerCount (1–64), QueueSize (>=1), DefaultSize (100–4000), QuietZone (0–20), LogoSource required when LogoOverlay is true, LogoSizeRatio (0.05–0.4), and MaskPattern (-1–7).
type ErrorCorrectionLevel ¶
type ErrorCorrectionLevel int
ErrorCorrectionLevel represents the Reed–Solomon error correction level for a QR code. Higher levels provide greater damage tolerance but reduce the available data capacity. The four standard levels are L (7%), M (15%), Q (25%), and H (30%).
LevelH is recommended when a logo overlay is used, as the additional redundancy helps scanners recover the original data despite the obstructed center modules.
const ( // LevelL recovers approximately 7% of codewords. // Suitable for clean environments where the QR code will not be damaged or obscured. LevelL ErrorCorrectionLevel = iota // LevelM recovers approximately 15% of codewords. // The default level and a good balance between capacity and resilience. LevelM // LevelQ recovers approximately 25% of codewords. // Recommended for QR codes that may be partially covered or printed on rough surfaces. LevelQ // LevelH recovers approximately 30% of codewords. // Recommended when using a logo overlay, as the highest redundancy compensates // for the obstructed center region. LevelH )
func (ErrorCorrectionLevel) String ¶
func (l ErrorCorrectionLevel) String() string
String returns the human-readable label for the error correction level. Returns "L", "M", "Q", or "H" for valid levels; defaults to "M".
type Format ¶
type Format int
Format enumerates the supported output formats for rendering QR codes.
Each format maps to a dedicated renderer in the renderer sub-package. The Format value is passed to Generator.GenerateToWriter to select the output encoding.
FormatPNG // raster PNG image, best for web and print FormatSVG // vector SVG, best for scalable or styled output FormatTerminal // Unicode block characters for CLI display FormatPDF // standalone PDF document FormatBase64 // base64-encoded PNG data URI for HTML embedding
const ( // FormatPNG renders the QR code as a PNG image. // Uses the standard Go image/png encoder. Supports module-style customization // including rounded, circle, and diamond shapes, gradient fills, and transparency. FormatPNG Format = iota // FormatSVG renders the QR code as a scalable vector graphic. // Produces a self-contained SVG document with no external dependencies. FormatSVG // FormatTerminal renders the QR code as Unicode block characters for terminal output. // Uses half-block characters (\u2580, \u2584, \u2588) to achieve near-square // module rendering. Supports 24-bit ANSI color codes when a foreground color is set. FormatTerminal // FormatPDF renders the QR code as a PDF document. // Generates a minimal PDF 1.4 file with the QR code centered on the page. FormatPDF // FormatBase64 renders the QR code as a base64-encoded PNG data URI. // Output is a "data:image/png;base64,..." string suitable for embedding in HTML // <img> tags or CSS backgrounds. FormatBase64 )
type Generator ¶
type Generator interface {
// Generate produces a QR code from the given payload using default options.
Generate(ctx context.Context, p payload.Payload) (*encoding.QRCode, error)
// GenerateWithOptions produces a QR code with per-call option overrides.
GenerateWithOptions(ctx context.Context, p payload.Payload, opts ...Option) (*encoding.QRCode, error)
// GenerateToWriter renders a QR code in the specified format and writes it to w.
GenerateToWriter(ctx context.Context, p payload.Payload, w io.Writer, format Format) error
// Batch generates multiple QR codes concurrently, one per payload.
Batch(ctx context.Context, payloads []payload.Payload, opts ...Option) ([]*encoding.QRCode, error)
// Close releases resources held by the generator.
Close(ctx context.Context) error
// Closed reports whether the generator has been closed.
Closed() bool
// SetOptions updates the generator's default options after construction.
SetOptions(opts ...Option) error
}
Generator is the primary interface for creating QR codes. All generation and rendering operations are performed through this interface. A Generator is safe for concurrent use: its internal configuration is protected by a read-write lock, and duplicate generation requests are deduplicated via a singleflight group.
The typical lifecycle is New, one or more Generate/GenerateToWriter calls, and Close. After Close, all subsequent method calls return an error with code ErrCodeClosed.
gen, err := qrcode.New(qrcode.WithErrorCorrection(qrcode.LevelH))
if err != nil { /* handle error */ }
defer gen.Close(ctx)
qr, err := gen.Generate(ctx, payload.URL("https://example.com")) err = gen.GenerateToWriter(ctx, p, os.Stdout, qrcode.FormatPNG).
func MustNew ¶
MustNew is like New but panics on error. Useful in package-level variable initialization where error handling is not practical.
var gen = qrcode.MustNew(qrcode.WithDefaultSize(512))
func New ¶
New creates a new Generator configured with the given options. If no options are provided, sensible defaults are applied: error correction level M, automatic version sizing, 300px image size, 4-module quiet zone, and 4 concurrent workers.
New validates the configuration and returns a wrapped validation error if any option produces an invalid combination (e.g., MinVersion > MaxVersion).
gen, err := qrcode.New(
qrcode.WithErrorCorrection(qrcode.LevelH),
qrcode.WithDefaultSize(400),
qrcode.WithQuietZone(4),
qrcode.WithLogo("logo.png", 0.25),
)
type Option ¶
type Option func(*Config)
Option configures a Generator at construction time. Options are applied to a default Config in the order they are provided, allowing later options to override earlier ones.
Options can also be applied after construction via Generator.SetOptions or Generator.GenerateWithOptions for per-call customization.
gen, err := qrcode.New(
qrcode.WithErrorCorrection(qrcode.LevelH),
qrcode.WithDefaultSize(400),
qrcode.WithLogo("logo.png", 0.25),
)
func WithAutoSize ¶
WithAutoSize enables or disables automatic version selection based on data length. When enabled (the default), the encoder automatically picks the smallest QR version that fits the data at the configured error correction level.
func WithBackgroundColor ¶
WithBackgroundColor sets the background color as a hex string (e.g. "#FFFFFF"). This color is used for the light modules and quiet zone of the QR code.
func WithConcurrency ¶
WithConcurrency sets the number of concurrent workers. This is an alias for WithWorkerCount provided for API clarity in batch-processing contexts.
func WithDefaultFormat ¶
WithDefaultFormat sets the default output format for rendering. Accepted values are FormatPNG, FormatSVG, FormatTerminal, and FormatPDF.
func WithDefaultSize ¶
WithDefaultSize sets the default image size in pixels for both width and height. Valid range is 100–4000. The default is 300 pixels.
func WithErrorCorrection ¶
func WithErrorCorrection(level ErrorCorrectionLevel) Option
WithErrorCorrection sets the default error correction level. Higher levels increase damage tolerance but reduce data capacity. Use LevelH when a logo overlay is applied.
func WithForegroundColor ¶
WithForegroundColor sets the foreground (module) color as a hex string (e.g. "#000000"). This color is used for the dark modules of the QR code. Supports gradients when used together with renderer.WithGradient.
func WithLogo ¶
WithLogo configures a logo to overlay at the center of the QR code. sizeRatio is the fraction of the QR code image the logo occupies (e.g. 0.25 means the logo width is 25% of the QR image width). Accepted range is 0.05–0.4. When a logo is used, LevelH error correction is strongly recommended.
func WithLogoOverlay ¶
WithLogoOverlay enables or disables logo overlay rendering. When enabled, the generator composites the configured logo image onto the center of the QR code. A logo source must be configured via WithLogo or by setting Config.LogoSource.
func WithLogoTint ¶
WithLogoTint applies a tint color to the overlaid logo. The tint is specified as a hex string (e.g. "#1a1a2e") and is applied by multiplying the logo's pixel colors with the tint, producing a colorized overlay that matches the QR theme.
func WithMaskPattern ¶
WithMaskPattern sets the mask pattern to use (0–7). Each mask pattern applies a different XOR formula to the data modules to optimize readability. Set to -1 (the default) for automatic selection, which evaluates all eight patterns and picks the one with the lowest penalty score.
func WithMaxVersion ¶
WithMaxVersion sets the maximum QR code version the auto-sizer may select (1–40). Useful to limit the physical size of the generated QR code.
func WithMinVersion ¶
WithMinVersion sets the minimum QR code version the auto-sizer may select (1–40). When AutoSize is enabled, the encoder will not choose a version smaller than this.
func WithPrefix ¶
WithPrefix sets a URI prefix prepended to the encoded payload data. This is useful when the raw encoded output needs to be wrapped in a URI scheme or namespace (e.g. "https://example.com/qr?").
func WithQueueSize ¶
WithQueueSize sets the capacity of the internal work queue (>=1). This option affects the batch.Processor pipeline.
func WithQuietZone ¶
WithQuietZone sets the number of quiet-zone (margin) modules around the QR code. The quiet zone is the blank border required by QR readers for reliable scanning. Valid range is 0–20; the default is 4.
func WithSlowOperation ¶
WithSlowOperation sets the threshold above which a generation is logged as slow. The default is 100ms. Set to 0 to disable slow-operation warnings.
func WithVersion ¶
WithVersion sets the default QR code version (1–40). When set to a non-zero value, automatic version selection is disabled and the specified version is used for all generations. Pair with WithAutoSize(false) to enforce the version.
func WithWorkerCount ¶
WithWorkerCount sets the number of worker goroutines for batch generation (1–64). This option affects the Generator.Batch method and the batch.Processor type.
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
Package batch provides concurrent batch processing for QR code generation with support for file output, JSON/CSV input parsing, and per-item statistics.
|
Package batch provides concurrent batch processing for QR code generation with support for file output, JSON/CSV input parsing, and per-item statistics. |
|
Package encoding implements the core QR code encoding pipeline including mode selection, data bitstream construction, Reed–Solomon error correction, mask pattern selection, and module matrix construction.
|
Package encoding implements the core QR code encoding pipeline including mode selection, data bitstream construction, Reed–Solomon error correction, mask pattern selection, and module matrix construction. |
|
Package errors provides structured error types for the QR code library.
|
Package errors provides structured error types for the QR code library. |
|
internal
|
|
|
hash
Package hash provides FNV-1a hashing utilities for keys and byte slices.
|
Package hash provides FNV-1a hashing utilities for keys and byte slices. |
|
lifecycle
Package lifecycle provides a concurrency-safe close guard that tracks whether a resource has been closed and signals waiters via a channel.
|
Package lifecycle provides a concurrency-safe close guard that tracks whether a resource has been closed and signals waiters via a channel. |
|
pool
Package pool provides a sync.Pool-backed pool of bytes.Buffer instances to reduce allocations in high-throughput QR code rendering paths.
|
Package pool provides a sync.Pool-backed pool of bytes.Buffer instances to reduce allocations in high-throughput QR code rendering paths. |
|
singleflight
Package singleflight provides a mechanism to suppress duplicate function calls.
|
Package singleflight provides a mechanism to suppress duplicate function calls. |
|
Package logo provides image loading, resizing, tinting, and overlay compositing for QR code center logo images.
|
Package logo provides image loading, resizing, tinting, and overlay compositing for QR code center logo images. |
|
Package payload provides convenience builder functions for constructing validated payload instances.
|
Package payload provides convenience builder functions for constructing validated payload instances. |
|
Package renderer provides QR code rendering in multiple output formats including PNG, SVG, PDF, terminal Unicode, and base64 with support for custom module styles, gradients, and transparency.
|
Package renderer provides QR code rendering in multiple output formats including PNG, SVG, PDF, terminal Unicode, and base64 with support for custom module styles, gradients, and transparency. |
|
Package testing provides contract tests and test utilities for the QR code library.
|
Package testing provides contract tests and test utilities for the QR code library. |