govote/http/qr.go

16 lines
276 B
Go
Raw Permalink Normal View History

2024-05-28 18:38:20 +00:00
package http
import (
b64 "encoding/base64"
"github.com/skip2/go-qrcode"
)
func generateQrCode(url string) (string, error) {
qrCode, err := qrcode.Encode(url, qrcode.Medium, 256)
if err != nil {
return "", err
}
return b64.StdEncoding.EncodeToString(qrCode), nil
}