16 lines
276 B
Go
16 lines
276 B
Go
|
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
|
||
|
}
|