hetty/pkg/api/models_gen.go
2020-02-23 22:07:46 +01:00

57 lines
960 B
Go

// Code generated by github.com/99designs/gqlgen, DO NOT EDIT.
package api
import (
"fmt"
"io"
"strconv"
"time"
)
type Request struct {
URL string `json:"url"`
Method HTTPMethod `json:"method"`
Timestamp time.Time `json:"timestamp"`
}
type HTTPMethod string
const (
HTTPMethodGet HTTPMethod = "GET"
HTTPMethodPost HTTPMethod = "POST"
)
var AllHTTPMethod = []HTTPMethod{
HTTPMethodGet,
HTTPMethodPost,
}
func (e HTTPMethod) IsValid() bool {
switch e {
case HTTPMethodGet, HTTPMethodPost:
return true
}
return false
}
func (e HTTPMethod) String() string {
return string(e)
}
func (e *HTTPMethod) UnmarshalGQL(v interface{}) error {
str, ok := v.(string)
if !ok {
return fmt.Errorf("enums must be strings")
}
*e = HTTPMethod(str)
if !e.IsValid() {
return fmt.Errorf("%s is not a valid HttpMethod", str)
}
return nil
}
func (e HTTPMethod) MarshalGQL(w io.Writer) {
fmt.Fprint(w, strconv.Quote(e.String()))
}