incidents

package
v0.0.6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 3, 2022 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func Create

func Create(c *gin.Context)

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

func NewIncident(item dataset.Incident) Incident
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"
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL