update naming of functions, add option to get count of unread messages of user

This commit is contained in:
2026-04-21 19:50:14 +02:00
parent a554c870ef
commit 422c4eb419
13 changed files with 178 additions and 484 deletions
+23 -2
View File
@@ -1,6 +1,7 @@
package convertions
import (
"errors"
"fmt"
"strconv"
"strings"
@@ -40,10 +41,30 @@ func Uint32ToRgba(v uint32) *types.Rgba {
return &types.Rgba{uint8(v >> 24), uint8(v >> 16), uint8(v >> 8), uint8(v)}
}
func ConvertStringUuid(str string) (uuid.UUID, error) {
func StringToUuid(str string) (uuid.UUID, error) {
return uuid.Parse(str)
}
func ConvertStringTimestamp(str string) (time.Time, error) {
func StringToUuidSlice(uuidStr string) (*[]uuid.UUID, error) {
if uuidStr == "" {
return nil, errors.New("empty string")
}
parts := strings.Split(uuidStr, ",")
slice := make([]uuid.UUID, len(parts))
for _, part := range parts {
id, err := StringToUuid(part)
if err != nil {
return nil, err
}
slice = append(slice, id)
}
return &slice, nil
}
func StringToTimestamp(str string) (time.Time, error) {
return time.Parse(time.RFC3339, str)
}