77 lines
1.3 KiB
Go
77 lines
1.3 KiB
Go
// Code generated by github.com/99designs/gqlgen, DO NOT EDIT.
|
|
|
|
package graph
|
|
|
|
import (
|
|
"bytes"
|
|
"fmt"
|
|
"io"
|
|
"strconv"
|
|
)
|
|
|
|
type Mutation struct {
|
|
}
|
|
|
|
type Query struct {
|
|
}
|
|
|
|
type Subscription struct {
|
|
}
|
|
|
|
type MessageStatus string
|
|
|
|
const (
|
|
MessageStatusSent MessageStatus = "SENT"
|
|
MessageStatusDelivered MessageStatus = "DELIVERED"
|
|
MessageStatusRead MessageStatus = "READ"
|
|
)
|
|
|
|
var AllMessageStatus = []MessageStatus{
|
|
MessageStatusSent,
|
|
MessageStatusDelivered,
|
|
MessageStatusRead,
|
|
}
|
|
|
|
func (e MessageStatus) IsValid() bool {
|
|
switch e {
|
|
case MessageStatusSent, MessageStatusDelivered, MessageStatusRead:
|
|
return true
|
|
}
|
|
return false
|
|
}
|
|
|
|
func (e MessageStatus) String() string {
|
|
return string(e)
|
|
}
|
|
|
|
func (e *MessageStatus) UnmarshalGQL(v any) error {
|
|
str, ok := v.(string)
|
|
if !ok {
|
|
return fmt.Errorf("enums must be strings")
|
|
}
|
|
|
|
*e = MessageStatus(str)
|
|
if !e.IsValid() {
|
|
return fmt.Errorf("%s is not a valid MessageStatus", str)
|
|
}
|
|
return nil
|
|
}
|
|
|
|
func (e MessageStatus) MarshalGQL(w io.Writer) {
|
|
fmt.Fprint(w, strconv.Quote(e.String()))
|
|
}
|
|
|
|
func (e *MessageStatus) UnmarshalJSON(b []byte) error {
|
|
s, err := strconv.Unquote(string(b))
|
|
if err != nil {
|
|
return err
|
|
}
|
|
return e.UnmarshalGQL(s)
|
|
}
|
|
|
|
func (e MessageStatus) MarshalJSON() ([]byte, error) {
|
|
var buf bytes.Buffer
|
|
e.MarshalGQL(&buf)
|
|
return buf.Bytes(), nil
|
|
}
|