init
This commit is contained in:
28
models/message.go
Normal file
28
models/message.go
Normal file
@@ -0,0 +1,28 @@
|
||||
package models
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"github.com/google/uuid"
|
||||
)
|
||||
|
||||
// #[derive(Debug, Clone, FromRow, Serialize, Deserialize)]
|
||||
//pub struct Message {
|
||||
// pub id: Uuid,
|
||||
// pub channel_id: Uuid,
|
||||
// pub user_id: Uuid,
|
||||
// pub content: String,
|
||||
// pub created_at: DateTime<Utc>,
|
||||
// pub edited_at: DateTime<Utc>,
|
||||
// pub reply_to_id: Option<Uuid>,
|
||||
//}
|
||||
|
||||
type Message struct {
|
||||
ID uuid.UUID `gorm:"primaryKey" json:"id"`
|
||||
ChannelID uuid.UUID `gorm:"index" json:"channel_id"`
|
||||
UserID uuid.UUID `gorm:"index" json:"user_id"`
|
||||
Content string `gorm:"not null" json:"content"`
|
||||
CreatedAt time.Time `gorm:"autoCreateTime" json:"created_at"`
|
||||
EditedAt *time.Time `gorm:"default:null" json:"edited_at,omitempty"`
|
||||
ReplyToID *uuid.UUID `gorm:"index" json:"reply_to_id,omitempty"`
|
||||
}
|
||||
Reference in New Issue
Block a user