dkforest

A forum and chat platform (onion)
git clone https://git.dasho.dev/n0tr1v/dkforest.git
Log | Files | Refs | LICENSE

commit 169059461d0a617fe1e28955f95f9850c7332c01
parent cc1f39846d3592040b45212ed0198550ba63929e
Author: n0tr1v <n0tr1v@protonmail.com>
Date:   Mon, 12 Dec 2022 20:50:47 -0500

strongly typed UploadID

Diffstat:
Mpkg/database/tableChatMessages.go | 2+-
Mpkg/database/tableUploads.go | 6++++--
2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/pkg/database/tableChatMessages.go b/pkg/database/tableChatMessages.go @@ -66,7 +66,7 @@ type ChatMessage struct { UserID UserID ToUserID *UserID GroupID *GroupID - UploadID *int64 + UploadID *UploadID CreatedAt time.Time User User Room ChatRoom diff --git a/pkg/database/tableUploads.go b/pkg/database/tableUploads.go @@ -10,8 +10,10 @@ import ( "github.com/sirupsen/logrus" ) +type UploadID int64 + type Upload struct { - ID int64 + ID UploadID UserID UserID FileName string OrigFileName string @@ -48,7 +50,7 @@ func GetUploadByFileName(filename string) (out Upload, err error) { return } -func GetUploadByID(uploadID int64) (out Upload, err error) { +func GetUploadByID(uploadID UploadID) (out Upload, err error) { err = DB.First(&out, "id = ?", uploadID).Error return }