2023-06-03 19:33:06 +01:00
|
|
|
package favicons
|
|
|
|
|
2024-03-08 16:05:39 +00:00
|
|
|
import "database/sql"
|
|
|
|
|
2023-06-03 19:33:06 +01:00
|
|
|
// FaviconImage stores the url, hash and raw bytes of an image
|
|
|
|
type FaviconImage struct {
|
|
|
|
Url string
|
|
|
|
Hash string
|
|
|
|
Raw []byte
|
|
|
|
}
|
|
|
|
|
|
|
|
// CreateFaviconImage outputs a FaviconImage with the specified URL or nil if
|
|
|
|
// the URL is an empty string.
|
2024-03-08 16:05:39 +00:00
|
|
|
func CreateFaviconImage(url sql.NullString) *FaviconImage {
|
|
|
|
if !url.Valid {
|
2023-06-03 19:33:06 +01:00
|
|
|
return nil
|
|
|
|
}
|
2024-03-08 16:05:39 +00:00
|
|
|
return &FaviconImage{Url: url.String}
|
2023-06-03 19:33:06 +01:00
|
|
|
}
|