util

package
v0.0.0-...-1e11cda Latest Latest
Warning

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

Go to latest
Published: Sep 25, 2025 License: AGPL-3.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DeletedURL = "https://api.dicebear.com/9.x/thumbs/svg?seed=Eden&backgroundColor=0a5b83&backgroundType[]&eyes[]&eyesColor[]&face[]&mouth[]"

Functions

func BanUnbanUser

func BanUnbanUser(db *gorm.DB, username string, ban bool) error

func ConnectDb

func ConnectDb(ConnStr string) error

func CreateImage

func CreateImage(db *gorm.DB, id string, userID uint, size uint) (*models.Image, error)

func GarbageCollector

func GarbageCollector(imagesPath string)

func GenerateAnonymousAvatar

func GenerateAnonymousAvatar(alias string) string

func GetAllReports

func GetAllReports(db *gorm.DB) ([]models.Report, error)

func GetBannedUsers

func GetBannedUsers(db *gorm.DB) ([]models.User, error)

func GetDb

func GetDb() *gorm.DB

func GetNumberOfImagesByUser

func GetNumberOfImagesByUser(db *gorm.DB, userID uint) (int64, error)

func GetOrCreateUserByID

func GetOrCreateUserByID(db *gorm.DB, id uint, username string) (*models.User, error)

func GetPublicAvatarURL

func GetPublicAvatarURL(userID uint) string

func GetTotalSizeOfImagesByUser

func GetTotalSizeOfImagesByUser(db *gorm.DB, userID uint) (uint64, error)

func GetUserByID

func GetUserByID(db *gorm.DB, id uint) (*models.User, error)

func GetUserByUsername

func GetUserByUsername(db *gorm.DB, username string) (*models.User, error)

func NewLoggerMiddleware

func NewLoggerMiddleware(next http.Handler) http.Handler

func SaveNewReport

func SaveNewReport(db *gorm.DB, answerID uint, cause string, userID uint) error

Types

type MuxieStatusRecorder

type MuxieStatusRecorder struct {
	*muxie.Writer
	StatusCode int
}

wrapper that records the status code

func NewMuxieStatusRecorder

func NewMuxieStatusRecorder(w http.ResponseWriter) *MuxieStatusRecorder

func (*MuxieStatusRecorder) Write

func (r *MuxieStatusRecorder) Write(b []byte) (int, error)

func (*MuxieStatusRecorder) WriteHeader

func (r *MuxieStatusRecorder) WriteHeader(code int)

Jump to

Keyboard shortcuts

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