23 lines
491 B
Go
23 lines
491 B
Go
package repository
|
|
|
|
import (
|
|
"gitea.neur0tx.site/Neur0toxine/vegapokerbot/internal/db/model"
|
|
"gorm.io/gorm"
|
|
)
|
|
|
|
type Integration struct {
|
|
db *gorm.DB
|
|
}
|
|
|
|
func NewIntegration(db *gorm.DB) *Integration {
|
|
return &Integration{db: db}
|
|
}
|
|
|
|
func (r *Integration) Save(integration *model.Integration) error {
|
|
return r.db.Model(integration).Save(integration).Error
|
|
}
|
|
|
|
func (r *Integration) DeleteForChat(id uint64) error {
|
|
return r.db.Where("chat_id = ?", id).Delete(&model.Integration{}).Error
|
|
}
|