Download goalert/engine/callback.go from Devendra174/react-code-dataset: direct link, hf CLI and curl.
- Browser
- Download file 473 Bytes
-
https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/f5071caa249115f3b590492f1c8eb471e02aae4b/goalert/engine/callback.go
- Command line
-
hf download hf://datasets/Devendra174/react-code-dataset@f5071caa249115f3b590492f1c8eb471e02aae4b/goalert/engine/callback.go
-
curl -L -o callback.go https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/f5071caa249115f3b590492f1c8eb471e02aae4b/goalert/engine/callback.go
473 Bytes
| package engine | |
| import ( | |
| "time" | |
| "github.com/target/goalert/validation/validate" | |
| "github.com/google/uuid" | |
| ) | |
| type callback struct { | |
| ID string | |
| AlertID int | |
| ServiceID string | |
| ContactMethodID uuid.UUID | |
| CreatedAt time.Time | |
| } | |
| func (c callback) Normalize() (*callback, error) { | |
| if c.ID == "" { | |
| c.ID = uuid.New().String() | |
| } | |
| err := validate.Many( | |
| validate.UUID("ID", c.ID), | |
| ) | |
| if err != nil { | |
| return nil, err | |
| } | |
| return &c, nil | |
| } | |