1234567891011121314151617181920212223242526272829303132333435363738 |
- // Copyright 2019 github.com. All rights reserved.
- // Use of this source code is governed by github.com.
- package model
- import (
- "encoding/json"
- "github.com/jaryhe/gopkgs/logger"
- "go.uber.org/zap"
- "github.com/jinzhu/gorm"
- )
- type TAlarmContact struct {
- Id uint64 `gorm:"primary_key"`
- ProjectId int64 `gorm:"column:project_id"`
- Phone string `gorm:"column:phone"`
- Email string `gorm:"column:email"`
- CreatedAt string `gorm:"column:created_at"`
- UpdatedAt string `json:"updated_at"`
- }
- func (TAlarmContact) TableName() string {
- return "t_alarm_contact"
- }
- func (p *TAlarmContact) Delete(db *gorm.DB, filter map[string]interface{}) error {
- err := db.Where(filter).Delete(p).Error
- if err != nil {
- fields, _ := json.Marshal(filter)
- logger.Error("mysql",
- zap.String("sql", "delete from t_alarm_contact"),
- zap.String("fields", string(fields)),
- zap.String("error", err.Error()))
- }
- return err
- }
|