39 lines
1022 B
Go
39 lines
1022 B
Go
package model
|
|
|
|
import (
|
|
"time"
|
|
|
|
modentity "spark-server/internal/module/moderation/entity"
|
|
)
|
|
|
|
type WordRow struct {
|
|
ID int64 `gorm:"column:id;primaryKey;autoIncrement"`
|
|
WordRaw string `gorm:"column:word_raw"`
|
|
Word string `gorm:"column:word"`
|
|
Category int8 `gorm:"column:category"`
|
|
Action int8 `gorm:"column:action"`
|
|
MuteSeconds int `gorm:"column:mute_seconds"`
|
|
Enabled int8 `gorm:"column:enabled"`
|
|
CreatedAt time.Time `gorm:"column:created_at"`
|
|
UpdatedAt time.Time `gorm:"column:updated_at"`
|
|
}
|
|
|
|
func (WordRow) TableName() string { return "t_sensitive_words" }
|
|
|
|
func (r *WordRow) entity() *modentity.Word {
|
|
if r == nil {
|
|
return nil
|
|
}
|
|
return &modentity.Word{
|
|
ID: r.ID,
|
|
WordRaw: r.WordRaw,
|
|
Word: r.Word,
|
|
Category: modentity.Category(r.Category),
|
|
Action: modentity.Action(r.Action),
|
|
MuteSeconds: r.MuteSeconds,
|
|
Enabled: r.Enabled == 1,
|
|
CreatedAt: r.CreatedAt,
|
|
UpdatedAt: r.UpdatedAt,
|
|
}
|
|
}
|