gitea_hat/models/webhook/webhook.go

22 lines
450 B
Go

package webhook
import (
"code.gitea.io/gitea/models/db"
gitea_webhook_model "code.gitea.io/gitea/models/webhook"
)
type Webhook struct {
gitea_webhook_model.Webhook
}
func GetWebhook(bean *Webhook) (*Webhook, error) {
webhook := bean.Webhook
has, err := db.GetEngine(db.DefaultContext).Get(&webhook)
if err != nil {
return nil, err
} else if !has {
return nil, gitea_webhook_model.ErrWebhookNotExist{webhook.ID}
}
return bean, nil
}