qrcode

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Jul 6, 2023 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ByteArrayWriteCloser

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

ByteArrayWriteCloser is a wrapper around a byte array that satisfies the io.WriteCloser interface.

func NewByteArrayWriteCloser

func NewByteArrayWriteCloser() *ByteArrayWriteCloser

NewByteArrayWriteCloser creates a new ByteArrayWriteCloser with the provided byte array.

func (*ByteArrayWriteCloser) Bytes

func (b *ByteArrayWriteCloser) Bytes() []byte

Bytes returns the underlying byte array.

func (*ByteArrayWriteCloser) Close

func (b *ByteArrayWriteCloser) Close() error

Close closes the underlying byte array.

func (*ByteArrayWriteCloser) Write

func (b *ByteArrayWriteCloser) Write(p []byte) (n int, err error)

Write writes data to the underlying byte array.

type ProductInfo

type ProductInfo struct {
	Host string
	Text string
}

ProductInfo represents a product

func (ProductInfo) Content

func (p ProductInfo) Content() (string, error)

Content returns the value from ProductInfo for which qrcode will be generated

type QRCode

type QRCode interface {
	Create(product ProductInfo) (QRResult, error)
	CreateN(product []ProductInfo) ([]QRResult, error)
	CreateWithWriter(product ProductInfo, writer io.WriteCloser) error
}

QRCode specifies the contraints related to qrcode generation

type QRConfig

type QRConfig struct {
	// Validates logo size as follows Width >= 2*logoWidth && qrHeight >= 2*logoHeight
	// Instead of default expression Width >= 5*logoWidth && qrHeight >= 5*logoHeight
	LogoPath   string
	BgHexColor string
	FgHexColor string
	Width      int
	Shape      ShapeType
}

QRConfig represnts the configuration to generate a QR Code

func DefaultQRConfig

func DefaultQRConfig() QRConfig

DefaultQRConfig returns a default QRConfig

type QRResult

type QRResult struct {
	ProductInfo ProductInfo
	QRCode      []byte
}

QRResult represent the result with qrcode

type ShapeType

type ShapeType string

ShapeType specifies the type of shape to generate a qr code

const (
	// RectangleShape will generate the QR Code with rectangular shape
	RectangleShape ShapeType = "rectangle"
	// CircleShape will generate the QR Code with circular shape
	CircleShape ShapeType = "circle"
)

Directories

Path Synopsis
Package yeqown is a wrapper around library Ref: https://github.com/yeqown/go-qrcode
Package yeqown is a wrapper around library Ref: https://github.com/yeqown/go-qrcode

Jump to

Keyboard shortcuts

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