Documentation
¶
Index ¶
- func DropDB() error
- func InitDB() error
- func UpgradeDB(fromVersion string, toVersion string) error
- type WebhookLogRecord
- func (w *WebhookLogRecord) Delete(params *dao.Params, ids string, queryFuncs ...func(*gorm.DB) *gorm.DB) error
- func (w *WebhookLogRecord) GetOne(params *dao.Params, queryFuncs ...func(*gorm.DB) *gorm.DB) (*WebhookLogRecord, error)
- func (w *WebhookLogRecord) GetStatistics(webhookID uint, startTime, endTime time.Time) (map[string]interface{}, error)
- func (w *WebhookLogRecord) List(params *dao.Params, queryFuncs ...func(*gorm.DB) *gorm.DB) ([]*WebhookLogRecord, int64, error)
- func (w *WebhookLogRecord) ListBySuccess(success bool, params *dao.Params) ([]*WebhookLogRecord, int64, error)
- func (w *WebhookLogRecord) ListByTimeRange(startTime, endTime time.Time, params *dao.Params) ([]*WebhookLogRecord, int64, error)
- func (w *WebhookLogRecord) ListByWebhookID(webhookID uint, params *dao.Params) ([]*WebhookLogRecord, int64, error)
- func (w *WebhookLogRecord) Save(params *dao.Params, queryFuncs ...func(*gorm.DB) *gorm.DB) error
- type WebhookReceiver
- func (c *WebhookReceiver) Delete(params *dao.Params, ids string, queryFuncs ...func(*gorm.DB) *gorm.DB) error
- func (c *WebhookReceiver) GetNamesByIds(ids []string) ([]string, error)
- func (c *WebhookReceiver) GetOne(params *dao.Params, queryFuncs ...func(*gorm.DB) *gorm.DB) (*WebhookReceiver, error)
- func (c *WebhookReceiver) GetReceiversByIds(ids []string) ([]*WebhookReceiver, error)
- func (c *WebhookReceiver) List(params *dao.Params, queryFuncs ...func(*gorm.DB) *gorm.DB) ([]*WebhookReceiver, int64, error)
- func (c *WebhookReceiver) Save(params *dao.Params, queryFuncs ...func(*gorm.DB) *gorm.DB) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type WebhookLogRecord ¶
type WebhookLogRecord struct {
ID uint `gorm:"primaryKey;autoIncrement" json:"id,omitempty"`
WebhookID uint `json:"webhook_id,omitempty" gorm:"index"` // webhook接收器ID
WebhookName string `json:"webhook_name,omitempty"` // webhook名称
ReceiverID string `json:"receiver_id,omitempty"` // 接收器ID
Method string `json:"method,omitempty"` // HTTP方法
URL string `json:"url,omitempty"` // 请求URL
StatusCode int `json:"status_code,omitempty"` // 响应状态码
Success bool `json:"success,omitempty" gorm:"index"` // 是否成功
Duration int64 `json:"duration,omitempty"` // 请求耗时(纳秒)
ErrorMessage string `json:"error_message,omitempty"` // 错误信息
Summary string `json:"summary,omitempty"` // 日志摘要
Detail string `gorm:"type:text" json:"detail,omitempty"` // 完整日志详情(JSON格式)
RequestTime time.Time `json:"request_time,omitempty" gorm:"index"` // 请求时间
CreatedAt time.Time `json:"created_at,omitempty" gorm:"<-:create"` // 创建时间
UpdatedAt time.Time `json:"updated_at,omitempty"` // 更新时间
}
WebhookLogRecord webhook发送日志记录
func (*WebhookLogRecord) Delete ¶
func (w *WebhookLogRecord) Delete(params *dao.Params, ids string, queryFuncs ...func(*gorm.DB) *gorm.DB) error
Delete 删除webhook日志
func (*WebhookLogRecord) GetOne ¶
func (w *WebhookLogRecord) GetOne(params *dao.Params, queryFuncs ...func(*gorm.DB) *gorm.DB) (*WebhookLogRecord, error)
GetOne 获取单个webhook日志
func (*WebhookLogRecord) GetStatistics ¶
func (w *WebhookLogRecord) GetStatistics(webhookID uint, startTime, endTime time.Time) (map[string]interface{}, error)
GetStatistics 获取webhook发送统计信息
func (*WebhookLogRecord) List ¶
func (w *WebhookLogRecord) List(params *dao.Params, queryFuncs ...func(*gorm.DB) *gorm.DB) ([]*WebhookLogRecord, int64, error)
List 查询webhook日志列表
func (*WebhookLogRecord) ListBySuccess ¶
func (w *WebhookLogRecord) ListBySuccess(success bool, params *dao.Params) ([]*WebhookLogRecord, int64, error)
ListBySuccess 根据成功状态查询日志
func (*WebhookLogRecord) ListByTimeRange ¶
func (w *WebhookLogRecord) ListByTimeRange(startTime, endTime time.Time, params *dao.Params) ([]*WebhookLogRecord, int64, error)
ListByTimeRange 根据时间范围查询日志
func (*WebhookLogRecord) ListByWebhookID ¶
func (w *WebhookLogRecord) ListByWebhookID(webhookID uint, params *dao.Params) ([]*WebhookLogRecord, int64, error)
ListByWebhookID 根据webhook ID查询日志
type WebhookReceiver ¶
type WebhookReceiver struct {
ID uint `gorm:"primaryKey;autoIncrement" json:"id,omitempty"`
Name string `json:"name,omitempty"` // webhook名称
Platform string `json:"platform,omitempty"` // feishu,dingtalk
TargetURL string `json:"target_url,omitempty"`
BodyTemplate string `gorm:"type:text" json:"body_template,omitempty"` // 发送到webhook的body模板
SignSecret string `json:"sign_secret,omitempty"`
CreatedAt time.Time `json:"created_at,omitempty" gorm:"<-:create"`
UpdatedAt time.Time `json:"updated_at,omitempty"` // Automatically managed by GORM for update time
}
func (*WebhookReceiver) GetNamesByIds ¶
func (c *WebhookReceiver) GetNamesByIds(ids []string) ([]string, error)
GetNamesByIds 根据webhook ID列表获取对应的名称列表
func (*WebhookReceiver) GetOne ¶
func (c *WebhookReceiver) GetOne(params *dao.Params, queryFuncs ...func(*gorm.DB) *gorm.DB) (*WebhookReceiver, error)
func (*WebhookReceiver) GetReceiversByIds ¶
func (c *WebhookReceiver) GetReceiversByIds(ids []string) ([]*WebhookReceiver, error)
GetReceiversByIds 根据逗号分隔的ID字符串查询webhook接收器列表 参数:ids - 逗号分隔的webhook ID字符串,例如 "1,2,3" 返回:webhook接收器列表和错误信息 如果ids为空,返回空列表
Click to show internal directories.
Click to hide internal directories.