git.sr.ht/~sircmpwn/gqlgen@v0.0.0-20200522192042-c84d29a1c940/integration/models-go/generated.go (about)

     1  // Code generated by git.sr.ht/~sircmpwn/gqlgen, DO NOT EDIT.
     2  
     3  package models
     4  
     5  import (
     6  	"fmt"
     7  	"io"
     8  	"strconv"
     9  )
    10  
    11  type DateFilter struct {
    12  	Value    string        `json:"value"`
    13  	Timezone *string       `json:"timezone"`
    14  	Op       *DateFilterOp `json:"op"`
    15  }
    16  
    17  type DateFilterOp string
    18  
    19  const (
    20  	DateFilterOpEq  DateFilterOp = "EQ"
    21  	DateFilterOpNeq DateFilterOp = "NEQ"
    22  	DateFilterOpGt  DateFilterOp = "GT"
    23  	DateFilterOpGte DateFilterOp = "GTE"
    24  	DateFilterOpLt  DateFilterOp = "LT"
    25  	DateFilterOpLte DateFilterOp = "LTE"
    26  )
    27  
    28  var AllDateFilterOp = []DateFilterOp{
    29  	DateFilterOpEq,
    30  	DateFilterOpNeq,
    31  	DateFilterOpGt,
    32  	DateFilterOpGte,
    33  	DateFilterOpLt,
    34  	DateFilterOpLte,
    35  }
    36  
    37  func (e DateFilterOp) IsValid() bool {
    38  	switch e {
    39  	case DateFilterOpEq, DateFilterOpNeq, DateFilterOpGt, DateFilterOpGte, DateFilterOpLt, DateFilterOpLte:
    40  		return true
    41  	}
    42  	return false
    43  }
    44  
    45  func (e DateFilterOp) String() string {
    46  	return string(e)
    47  }
    48  
    49  func (e *DateFilterOp) UnmarshalGQL(v interface{}) error {
    50  	str, ok := v.(string)
    51  	if !ok {
    52  		return fmt.Errorf("enums must be strings")
    53  	}
    54  
    55  	*e = DateFilterOp(str)
    56  	if !e.IsValid() {
    57  		return fmt.Errorf("%s is not a valid DATE_FILTER_OP", str)
    58  	}
    59  	return nil
    60  }
    61  
    62  func (e DateFilterOp) MarshalGQL(w io.Writer) {
    63  	fmt.Fprint(w, strconv.Quote(e.String()))
    64  }
    65  
    66  type ErrorType string
    67  
    68  const (
    69  	ErrorTypeCustom ErrorType = "CUSTOM"
    70  	ErrorTypeNormal ErrorType = "NORMAL"
    71  )
    72  
    73  var AllErrorType = []ErrorType{
    74  	ErrorTypeCustom,
    75  	ErrorTypeNormal,
    76  }
    77  
    78  func (e ErrorType) IsValid() bool {
    79  	switch e {
    80  	case ErrorTypeCustom, ErrorTypeNormal:
    81  		return true
    82  	}
    83  	return false
    84  }
    85  
    86  func (e ErrorType) String() string {
    87  	return string(e)
    88  }
    89  
    90  func (e *ErrorType) UnmarshalGQL(v interface{}) error {
    91  	str, ok := v.(string)
    92  	if !ok {
    93  		return fmt.Errorf("enums must be strings")
    94  	}
    95  
    96  	*e = ErrorType(str)
    97  	if !e.IsValid() {
    98  		return fmt.Errorf("%s is not a valid ErrorType", str)
    99  	}
   100  	return nil
   101  }
   102  
   103  func (e ErrorType) MarshalGQL(w io.Writer) {
   104  	fmt.Fprint(w, strconv.Quote(e.String()))
   105  }