Documentation
¶
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Incident ¶
type Incident struct {
ID string `json:"id,omitempty"`
Owner string `json:"owner,omitempty"`
Repository string `json:"repository,omitempty"`
Description string `json:"description,omitempty"`
SHA string `json:"sha"`
InsertedAt string `json:"inserted_at,omitempty"`
ResolvedAt string `json:"resolved_at"`
}
func NewIncident ¶ added in v0.0.5
Example ¶
package main
import (
"encoding/json"
"fmt"
"time"
"github.com/itsubaki/fourkeys/dataset"
"github.com/itsubaki/fourkeys/handler/incidents"
)
func main() {
incident := incidents.NewIncident(dataset.Incident{
ID: "01GDWBDNQ3G71RCNN1P0V5K9ZT",
Owner: "itsubaki",
Repository: "fourkeys",
Description: "something went wrong",
SHA: "8741778e70285e0ffbf17ff9fca7477c2bed2bcc",
InsertedAt: time.Date(2014, time.December, 31, 12, 13, 24, 0, time.UTC),
ResolvedAt: time.Date(2014, time.December, 31, 12, 13, 24, 0, time.UTC),
})
data, err := json.MarshalIndent(incident, "", " ")
if err != nil {
fmt.Printf("json marshal: %v", err)
return
}
fmt.Println(string(data))
}
Output: { "id": "01GDWBDNQ3G71RCNN1P0V5K9ZT", "owner": "itsubaki", "repository": "fourkeys", "description": "something went wrong", "sha": "8741778e70285e0ffbf17ff9fca7477c2bed2bcc", "inserted_at": "2014-12-31 12:13:24 UTC", "resolved_at": "2014-12-31 12:13:24 UTC" }
Click to show internal directories.
Click to hide internal directories.