Module project, commit, submission
All checks were successful
Build and Release / release (push) Successful in 1m15s

This commit is contained in:
2026-04-26 16:31:03 +07:00
parent ac90236022
commit 6918a100fc
60 changed files with 5957 additions and 1020 deletions

View File

@@ -1,11 +1,20 @@
package convert
import (
"crypto/md5"
"encoding/json"
"fmt"
"time"
"github.com/jackc/pgx/v5/pgtype"
)
func GenerateQueryKey(prefix string, params any) string {
b, _ := json.Marshal(params)
hash := fmt.Sprintf("%x", md5.Sum(b))
return fmt.Sprintf("%s:query:%s", prefix, hash)
}
func UUIDToString(v pgtype.UUID) string {
if v.Valid {
return v.String()
@@ -75,6 +84,16 @@ func PtrToText(s *string) pgtype.Text {
}
}
func StringToText(s string) pgtype.Text {
if s == "" {
return pgtype.Text{Valid: false}
}
return pgtype.Text{
String: s,
Valid: true,
}
}
func TextToPtr(v pgtype.Text) *string {
if !v.Valid {
return nil