barcodes/generation/generate.go
2023-09-01 20:50:47 +01:00

32 lines
723 B
Go

package generation
import (
"fmt"
"github.com/boombuler/barcode"
)
func Generate(parameters Parameters) (barcode.Barcode, error) {
var barcode_content barcode.Barcode
var err error
switch parameters.Format {
case Aztec:
barcode_content, err = generateAztec(parameters)
case Codabar:
barcode_content, err = generateCodabar(parameters)
case Code93:
barcode_content, err = generateCode93(parameters)
case Code128:
barcode_content, err = generateCode128(parameters)
case QR:
barcode_content, err = generateQr(parameters)
case Datamatrix:
barcode_content, err = generateDatamatrix(parameters)
default:
fmt.Println("Unsupported barcode type: ", parameters.Format)
}
return barcode_content, err
}