integer id

This commit is contained in:
2023-09-15 18:00:17 +08:00
parent 687fffead3
commit 7c53581ff2
2 changed files with 74 additions and 30 deletions

View File

@@ -6,31 +6,19 @@ import (
"strings"
"time"
"github.com/gin-gonic/gin"
"github.com/google/uuid"
"gorm.io/gorm"
)
type Record struct {
ID uuid.UUID `gorm:"type:uuid"`
ID int64 `gorm:"primaryKey,autoIncrement"`
CreatedAt time.Time
IP string
Body string
Body string `gorm:"serializer:json"`
Response string
ElapsedTime time.Duration
}
func recordUserMessage(c *gin.Context, db *gorm.DB, trackID uuid.UUID, body []byte) {
bodyStr := string(body)
requestRecord := Record{
Body: bodyStr,
ID: trackID,
IP: c.ClientIP(),
}
err := db.Create(&requestRecord).Error
if err != nil {
log.Println("Error record request:", err)
}
Status int
UpstreamID uint
}
type StreamModeChunk struct {