Files
go-telegram-bot/models.go
2024-10-13 02:58:18 +02:00

37 lines
495 B
Go

package main
import (
"time"
"gorm.io/gorm"
)
type Message struct {
gorm.Model
ChatID int64
UserID int64
Username string
UserRole string
Text string
Timestamp time.Time
IsUser bool
}
type ChatMemory struct {
Messages []Message
Size int
}
type Role struct {
gorm.Model
Name string `gorm:"uniqueIndex"`
}
type User struct {
gorm.Model
TelegramID int64 `gorm:"uniqueIndex"`
Username string
RoleID uint
Role Role `gorm:"foreignKey:RoleID"`
}