MCPcopy Create free account
hub / github.com/gogs/gogs / AfterSet

Method AfterSet

internal/database/webhook.go:467–493  ·  view source on GitHub ↗
(colName string, _ xorm.Cell)

Source from the content-addressed store, hash-verified

465}
466
467func (t *HookTask) AfterSet(colName string, _ xorm.Cell) {
468 var err error
469 switch colName {
470 case "delivered":
471 t.DeliveredString = time.Unix(0, t.Delivered).Format("2006-01-02 15:04:05 MST")
472
473 case "request_content":
474 if t.RequestContent == "" {
475 return
476 }
477
478 t.RequestInfo = &HookRequest{}
479 if err = jsoniter.Unmarshal([]byte(t.RequestContent), t.RequestInfo); err != nil {
480 log.Error("Unmarshal[%d]: %v", t.ID, err)
481 }
482
483 case "response_content":
484 if t.ResponseContent == "" {
485 return
486 }
487
488 t.ResponseInfo = &HookResponse{}
489 if err = jsoniter.Unmarshal([]byte(t.ResponseContent), t.ResponseInfo); err != nil {
490 log.Error("Unmarshal [%d]: %v", t.ID, err)
491 }
492 }
493}
494
495func (t *HookTask) ToJSON(v any) string {
496 p, err := jsoniter.Marshal(v)

Callers

nothing calls this directly

Calls 1

ErrorMethod · 0.45

Tested by

no test coverage detected