Upgrade gqlgenc (#5901)

* Update gqlgenc
* Fix type error
* Fix package names in config
* Remove override and regenerate
* Update compiler and bump version
This commit is contained in:
WithoutPants
2025-06-03 08:55:51 +10:00
committed by GitHub
parent 044ed2708f
commit 00f5d0d984
15 changed files with 579 additions and 187 deletions

View File

@@ -197,13 +197,13 @@ func TestConcurrentExclusiveAndReadTxn(t *testing.T) {
_ = txn.WithReadTxn(ctx, db, func(ctx context.Context) error {
// wait for first thread
if err := waitForOtherThread(c); err != nil {
t.Errorf(err.Error())
t.Error(err.Error())
return err
}
defer func() {
if err := signalOtherThread(c); err != nil {
t.Errorf(err.Error())
t.Error(err.Error())
}
}()

View File

@@ -19,8 +19,9 @@ const DefaultMaxRequestsPerMinute = 240
// Client represents the client interface to a stash-box server instance.
type Client struct {
client *graphql.Client
box models.StashBox
client *graphql.Client
httpClient *http.Client
box models.StashBox
maxRequestsPerMinute int
@@ -70,6 +71,7 @@ func NewClient(box models.StashBox, options ...ClientOption) *Client {
ret := &Client{
box: box,
maxRequestsPerMinute: DefaultMaxRequestsPerMinute,
httpClient: http.DefaultClient,
}
if box.MaxRequestsPerMinute > 0 {
@@ -84,7 +86,7 @@ func NewClient(box models.StashBox, options ...ClientOption) *Client {
limitRequests := rateLimit(ret.maxRequestsPerMinute)
client := &graphql.Client{
Client: clientv2.NewClient(http.DefaultClient, box.Endpoint, nil, authHeader, limitRequests),
Client: clientv2.NewClient(ret.httpClient, box.Endpoint, nil, authHeader, limitRequests),
}
ret.client = client
@@ -92,10 +94,6 @@ func NewClient(box models.StashBox, options ...ClientOption) *Client {
return ret
}
func (c Client) getHTTPClient() *http.Client {
return c.client.Client.Client
}
func (c Client) GetUser(ctx context.Context) (*graphql.Me, error) {
return c.client.Me(ctx)
}

View File

@@ -4,7 +4,6 @@ package graphql
import (
"context"
"net/http"
"github.com/Yamashou/gqlgenc/clientv2"
)
@@ -28,7 +27,7 @@ type Client struct {
Client *clientv2.Client
}
func NewClient(cli *http.Client, baseURL string, options *clientv2.Options, interceptors ...clientv2.RequestInterceptor) StashBoxGraphQLClient {
func NewClient(cli clientv2.HttpClient, baseURL string, options *clientv2.Options, interceptors ...clientv2.RequestInterceptor) StashBoxGraphQLClient {
return &Client{Client: clientv2.NewClient(cli, baseURL, options, interceptors...)}
}
@@ -493,148 +492,148 @@ func (t *SceneFragment) GetFingerprints() []*FingerprintFragment {
}
type StudioFragment_Parent struct {
Name string "json:\"name\" graphql:\"name\""
ID string "json:\"id\" graphql:\"id\""
Name string "json:\"name\" graphql:\"name\""
}
func (t *StudioFragment_Parent) GetName() string {
if t == nil {
t = &StudioFragment_Parent{}
}
return t.Name
}
func (t *StudioFragment_Parent) GetID() string {
if t == nil {
t = &StudioFragment_Parent{}
}
return t.ID
}
type SceneFragment_Studio_StudioFragment_Parent struct {
Name string "json:\"name\" graphql:\"name\""
ID string "json:\"id\" graphql:\"id\""
}
func (t *SceneFragment_Studio_StudioFragment_Parent) GetName() string {
func (t *StudioFragment_Parent) GetName() string {
if t == nil {
t = &SceneFragment_Studio_StudioFragment_Parent{}
t = &StudioFragment_Parent{}
}
return t.Name
}
type SceneFragment_Studio_StudioFragment_Parent struct {
ID string "json:\"id\" graphql:\"id\""
Name string "json:\"name\" graphql:\"name\""
}
func (t *SceneFragment_Studio_StudioFragment_Parent) GetID() string {
if t == nil {
t = &SceneFragment_Studio_StudioFragment_Parent{}
}
return t.ID
}
type FindSceneByFingerprint_FindSceneByFingerprint_SceneFragment_Studio_StudioFragment_Parent struct {
Name string "json:\"name\" graphql:\"name\""
ID string "json:\"id\" graphql:\"id\""
}
func (t *FindSceneByFingerprint_FindSceneByFingerprint_SceneFragment_Studio_StudioFragment_Parent) GetName() string {
func (t *SceneFragment_Studio_StudioFragment_Parent) GetName() string {
if t == nil {
t = &FindSceneByFingerprint_FindSceneByFingerprint_SceneFragment_Studio_StudioFragment_Parent{}
t = &SceneFragment_Studio_StudioFragment_Parent{}
}
return t.Name
}
type FindSceneByFingerprint_FindSceneByFingerprint_SceneFragment_Studio_StudioFragment_Parent struct {
ID string "json:\"id\" graphql:\"id\""
Name string "json:\"name\" graphql:\"name\""
}
func (t *FindSceneByFingerprint_FindSceneByFingerprint_SceneFragment_Studio_StudioFragment_Parent) GetID() string {
if t == nil {
t = &FindSceneByFingerprint_FindSceneByFingerprint_SceneFragment_Studio_StudioFragment_Parent{}
}
return t.ID
}
type FindScenesByFullFingerprints_FindScenesByFullFingerprints_SceneFragment_Studio_StudioFragment_Parent struct {
Name string "json:\"name\" graphql:\"name\""
ID string "json:\"id\" graphql:\"id\""
}
func (t *FindScenesByFullFingerprints_FindScenesByFullFingerprints_SceneFragment_Studio_StudioFragment_Parent) GetName() string {
func (t *FindSceneByFingerprint_FindSceneByFingerprint_SceneFragment_Studio_StudioFragment_Parent) GetName() string {
if t == nil {
t = &FindScenesByFullFingerprints_FindScenesByFullFingerprints_SceneFragment_Studio_StudioFragment_Parent{}
t = &FindSceneByFingerprint_FindSceneByFingerprint_SceneFragment_Studio_StudioFragment_Parent{}
}
return t.Name
}
type FindScenesByFullFingerprints_FindScenesByFullFingerprints_SceneFragment_Studio_StudioFragment_Parent struct {
ID string "json:\"id\" graphql:\"id\""
Name string "json:\"name\" graphql:\"name\""
}
func (t *FindScenesByFullFingerprints_FindScenesByFullFingerprints_SceneFragment_Studio_StudioFragment_Parent) GetID() string {
if t == nil {
t = &FindScenesByFullFingerprints_FindScenesByFullFingerprints_SceneFragment_Studio_StudioFragment_Parent{}
}
return t.ID
}
type FindScenesBySceneFingerprints_FindScenesBySceneFingerprints_SceneFragment_Studio_StudioFragment_Parent struct {
Name string "json:\"name\" graphql:\"name\""
ID string "json:\"id\" graphql:\"id\""
}
func (t *FindScenesBySceneFingerprints_FindScenesBySceneFingerprints_SceneFragment_Studio_StudioFragment_Parent) GetName() string {
func (t *FindScenesByFullFingerprints_FindScenesByFullFingerprints_SceneFragment_Studio_StudioFragment_Parent) GetName() string {
if t == nil {
t = &FindScenesBySceneFingerprints_FindScenesBySceneFingerprints_SceneFragment_Studio_StudioFragment_Parent{}
t = &FindScenesByFullFingerprints_FindScenesByFullFingerprints_SceneFragment_Studio_StudioFragment_Parent{}
}
return t.Name
}
type FindScenesBySceneFingerprints_FindScenesBySceneFingerprints_SceneFragment_Studio_StudioFragment_Parent struct {
ID string "json:\"id\" graphql:\"id\""
Name string "json:\"name\" graphql:\"name\""
}
func (t *FindScenesBySceneFingerprints_FindScenesBySceneFingerprints_SceneFragment_Studio_StudioFragment_Parent) GetID() string {
if t == nil {
t = &FindScenesBySceneFingerprints_FindScenesBySceneFingerprints_SceneFragment_Studio_StudioFragment_Parent{}
}
return t.ID
}
type SearchScene_SearchScene_SceneFragment_Studio_StudioFragment_Parent struct {
Name string "json:\"name\" graphql:\"name\""
ID string "json:\"id\" graphql:\"id\""
}
func (t *SearchScene_SearchScene_SceneFragment_Studio_StudioFragment_Parent) GetName() string {
func (t *FindScenesBySceneFingerprints_FindScenesBySceneFingerprints_SceneFragment_Studio_StudioFragment_Parent) GetName() string {
if t == nil {
t = &SearchScene_SearchScene_SceneFragment_Studio_StudioFragment_Parent{}
t = &FindScenesBySceneFingerprints_FindScenesBySceneFingerprints_SceneFragment_Studio_StudioFragment_Parent{}
}
return t.Name
}
type SearchScene_SearchScene_SceneFragment_Studio_StudioFragment_Parent struct {
ID string "json:\"id\" graphql:\"id\""
Name string "json:\"name\" graphql:\"name\""
}
func (t *SearchScene_SearchScene_SceneFragment_Studio_StudioFragment_Parent) GetID() string {
if t == nil {
t = &SearchScene_SearchScene_SceneFragment_Studio_StudioFragment_Parent{}
}
return t.ID
}
type FindSceneByID_FindScene_SceneFragment_Studio_StudioFragment_Parent struct {
Name string "json:\"name\" graphql:\"name\""
ID string "json:\"id\" graphql:\"id\""
}
func (t *FindSceneByID_FindScene_SceneFragment_Studio_StudioFragment_Parent) GetName() string {
func (t *SearchScene_SearchScene_SceneFragment_Studio_StudioFragment_Parent) GetName() string {
if t == nil {
t = &FindSceneByID_FindScene_SceneFragment_Studio_StudioFragment_Parent{}
t = &SearchScene_SearchScene_SceneFragment_Studio_StudioFragment_Parent{}
}
return t.Name
}
type FindSceneByID_FindScene_SceneFragment_Studio_StudioFragment_Parent struct {
ID string "json:\"id\" graphql:\"id\""
Name string "json:\"name\" graphql:\"name\""
}
func (t *FindSceneByID_FindScene_SceneFragment_Studio_StudioFragment_Parent) GetID() string {
if t == nil {
t = &FindSceneByID_FindScene_SceneFragment_Studio_StudioFragment_Parent{}
}
return t.ID
}
type FindStudio_FindStudio_StudioFragment_Parent struct {
Name string "json:\"name\" graphql:\"name\""
ID string "json:\"id\" graphql:\"id\""
}
func (t *FindStudio_FindStudio_StudioFragment_Parent) GetName() string {
func (t *FindSceneByID_FindScene_SceneFragment_Studio_StudioFragment_Parent) GetName() string {
if t == nil {
t = &FindStudio_FindStudio_StudioFragment_Parent{}
t = &FindSceneByID_FindScene_SceneFragment_Studio_StudioFragment_Parent{}
}
return t.Name
}
type FindStudio_FindStudio_StudioFragment_Parent struct {
ID string "json:\"id\" graphql:\"id\""
Name string "json:\"name\" graphql:\"name\""
}
func (t *FindStudio_FindStudio_StudioFragment_Parent) GetID() string {
if t == nil {
t = &FindStudio_FindStudio_StudioFragment_Parent{}
}
return t.ID
}
func (t *FindStudio_FindStudio_StudioFragment_Parent) GetName() string {
if t == nil {
t = &FindStudio_FindStudio_StudioFragment_Parent{}
}
return t.Name
}
type Me_Me struct {
Name string "json:\"name\" graphql:\"name\""

View File

@@ -3,6 +3,7 @@
package graphql
import (
"bytes"
"fmt"
"io"
"strconv"
@@ -870,6 +871,23 @@ type SceneDraft struct {
func (SceneDraft) IsDraftData() {}
type SceneDraftInput struct {
ID *string `json:"id,omitempty"`
Title *string `json:"title,omitempty"`
Code *string `json:"code,omitempty"`
Details *string `json:"details,omitempty"`
Director *string `json:"director,omitempty"`
URL *string `json:"url,omitempty"`
Urls []string `json:"urls,omitempty"`
Date *string `json:"date,omitempty"`
ProductionDate *string `json:"production_date,omitempty"`
Studio *DraftEntityInput `json:"studio,omitempty"`
Performers []*DraftEntityInput `json:"performers"`
Tags []*DraftEntityInput `json:"tags,omitempty"`
Image *graphql.Upload `json:"image,omitempty"`
Fingerprints []*FingerprintInput `json:"fingerprints"`
}
type SceneEdit struct {
Title *string `json:"title,omitempty"`
Details *string `json:"details,omitempty"`
@@ -1361,7 +1379,7 @@ func (e BreastTypeEnum) String() string {
return string(e)
}
func (e *BreastTypeEnum) UnmarshalGQL(v interface{}) error {
func (e *BreastTypeEnum) UnmarshalGQL(v any) error {
str, ok := v.(string)
if !ok {
return fmt.Errorf("enums must be strings")
@@ -1378,6 +1396,20 @@ func (e BreastTypeEnum) MarshalGQL(w io.Writer) {
fmt.Fprint(w, strconv.Quote(e.String()))
}
func (e *BreastTypeEnum) UnmarshalJSON(b []byte) error {
s, err := strconv.Unquote(string(b))
if err != nil {
return err
}
return e.UnmarshalGQL(s)
}
func (e BreastTypeEnum) MarshalJSON() ([]byte, error) {
var buf bytes.Buffer
e.MarshalGQL(&buf)
return buf.Bytes(), nil
}
type CriterionModifier string
const (
@@ -1423,7 +1455,7 @@ func (e CriterionModifier) String() string {
return string(e)
}
func (e *CriterionModifier) UnmarshalGQL(v interface{}) error {
func (e *CriterionModifier) UnmarshalGQL(v any) error {
str, ok := v.(string)
if !ok {
return fmt.Errorf("enums must be strings")
@@ -1440,6 +1472,20 @@ func (e CriterionModifier) MarshalGQL(w io.Writer) {
fmt.Fprint(w, strconv.Quote(e.String()))
}
func (e *CriterionModifier) UnmarshalJSON(b []byte) error {
s, err := strconv.Unquote(string(b))
if err != nil {
return err
}
return e.UnmarshalGQL(s)
}
func (e CriterionModifier) MarshalJSON() ([]byte, error) {
var buf bytes.Buffer
e.MarshalGQL(&buf)
return buf.Bytes(), nil
}
type DateAccuracyEnum string
const (
@@ -1466,7 +1512,7 @@ func (e DateAccuracyEnum) String() string {
return string(e)
}
func (e *DateAccuracyEnum) UnmarshalGQL(v interface{}) error {
func (e *DateAccuracyEnum) UnmarshalGQL(v any) error {
str, ok := v.(string)
if !ok {
return fmt.Errorf("enums must be strings")
@@ -1483,6 +1529,20 @@ func (e DateAccuracyEnum) MarshalGQL(w io.Writer) {
fmt.Fprint(w, strconv.Quote(e.String()))
}
func (e *DateAccuracyEnum) UnmarshalJSON(b []byte) error {
s, err := strconv.Unquote(string(b))
if err != nil {
return err
}
return e.UnmarshalGQL(s)
}
func (e DateAccuracyEnum) MarshalJSON() ([]byte, error) {
var buf bytes.Buffer
e.MarshalGQL(&buf)
return buf.Bytes(), nil
}
type EditSortEnum string
const (
@@ -1509,7 +1569,7 @@ func (e EditSortEnum) String() string {
return string(e)
}
func (e *EditSortEnum) UnmarshalGQL(v interface{}) error {
func (e *EditSortEnum) UnmarshalGQL(v any) error {
str, ok := v.(string)
if !ok {
return fmt.Errorf("enums must be strings")
@@ -1526,6 +1586,20 @@ func (e EditSortEnum) MarshalGQL(w io.Writer) {
fmt.Fprint(w, strconv.Quote(e.String()))
}
func (e *EditSortEnum) UnmarshalJSON(b []byte) error {
s, err := strconv.Unquote(string(b))
if err != nil {
return err
}
return e.UnmarshalGQL(s)
}
func (e EditSortEnum) MarshalJSON() ([]byte, error) {
var buf bytes.Buffer
e.MarshalGQL(&buf)
return buf.Bytes(), nil
}
type EthnicityEnum string
const (
@@ -1562,7 +1636,7 @@ func (e EthnicityEnum) String() string {
return string(e)
}
func (e *EthnicityEnum) UnmarshalGQL(v interface{}) error {
func (e *EthnicityEnum) UnmarshalGQL(v any) error {
str, ok := v.(string)
if !ok {
return fmt.Errorf("enums must be strings")
@@ -1579,6 +1653,20 @@ func (e EthnicityEnum) MarshalGQL(w io.Writer) {
fmt.Fprint(w, strconv.Quote(e.String()))
}
func (e *EthnicityEnum) UnmarshalJSON(b []byte) error {
s, err := strconv.Unquote(string(b))
if err != nil {
return err
}
return e.UnmarshalGQL(s)
}
func (e EthnicityEnum) MarshalJSON() ([]byte, error) {
var buf bytes.Buffer
e.MarshalGQL(&buf)
return buf.Bytes(), nil
}
type EthnicityFilterEnum string
const (
@@ -1617,7 +1705,7 @@ func (e EthnicityFilterEnum) String() string {
return string(e)
}
func (e *EthnicityFilterEnum) UnmarshalGQL(v interface{}) error {
func (e *EthnicityFilterEnum) UnmarshalGQL(v any) error {
str, ok := v.(string)
if !ok {
return fmt.Errorf("enums must be strings")
@@ -1634,6 +1722,20 @@ func (e EthnicityFilterEnum) MarshalGQL(w io.Writer) {
fmt.Fprint(w, strconv.Quote(e.String()))
}
func (e *EthnicityFilterEnum) UnmarshalJSON(b []byte) error {
s, err := strconv.Unquote(string(b))
if err != nil {
return err
}
return e.UnmarshalGQL(s)
}
func (e EthnicityFilterEnum) MarshalJSON() ([]byte, error) {
var buf bytes.Buffer
e.MarshalGQL(&buf)
return buf.Bytes(), nil
}
type EyeColorEnum string
const (
@@ -1666,7 +1768,7 @@ func (e EyeColorEnum) String() string {
return string(e)
}
func (e *EyeColorEnum) UnmarshalGQL(v interface{}) error {
func (e *EyeColorEnum) UnmarshalGQL(v any) error {
str, ok := v.(string)
if !ok {
return fmt.Errorf("enums must be strings")
@@ -1683,6 +1785,20 @@ func (e EyeColorEnum) MarshalGQL(w io.Writer) {
fmt.Fprint(w, strconv.Quote(e.String()))
}
func (e *EyeColorEnum) UnmarshalJSON(b []byte) error {
s, err := strconv.Unquote(string(b))
if err != nil {
return err
}
return e.UnmarshalGQL(s)
}
func (e EyeColorEnum) MarshalJSON() ([]byte, error) {
var buf bytes.Buffer
e.MarshalGQL(&buf)
return buf.Bytes(), nil
}
type FavoriteFilter string
const (
@@ -1709,7 +1825,7 @@ func (e FavoriteFilter) String() string {
return string(e)
}
func (e *FavoriteFilter) UnmarshalGQL(v interface{}) error {
func (e *FavoriteFilter) UnmarshalGQL(v any) error {
str, ok := v.(string)
if !ok {
return fmt.Errorf("enums must be strings")
@@ -1726,6 +1842,20 @@ func (e FavoriteFilter) MarshalGQL(w io.Writer) {
fmt.Fprint(w, strconv.Quote(e.String()))
}
func (e *FavoriteFilter) UnmarshalJSON(b []byte) error {
s, err := strconv.Unquote(string(b))
if err != nil {
return err
}
return e.UnmarshalGQL(s)
}
func (e FavoriteFilter) MarshalJSON() ([]byte, error) {
var buf bytes.Buffer
e.MarshalGQL(&buf)
return buf.Bytes(), nil
}
type FingerprintAlgorithm string
const (
@@ -1752,7 +1882,7 @@ func (e FingerprintAlgorithm) String() string {
return string(e)
}
func (e *FingerprintAlgorithm) UnmarshalGQL(v interface{}) error {
func (e *FingerprintAlgorithm) UnmarshalGQL(v any) error {
str, ok := v.(string)
if !ok {
return fmt.Errorf("enums must be strings")
@@ -1769,6 +1899,20 @@ func (e FingerprintAlgorithm) MarshalGQL(w io.Writer) {
fmt.Fprint(w, strconv.Quote(e.String()))
}
func (e *FingerprintAlgorithm) UnmarshalJSON(b []byte) error {
s, err := strconv.Unquote(string(b))
if err != nil {
return err
}
return e.UnmarshalGQL(s)
}
func (e FingerprintAlgorithm) MarshalJSON() ([]byte, error) {
var buf bytes.Buffer
e.MarshalGQL(&buf)
return buf.Bytes(), nil
}
type FingerprintSubmissionType string
const (
@@ -1798,7 +1942,7 @@ func (e FingerprintSubmissionType) String() string {
return string(e)
}
func (e *FingerprintSubmissionType) UnmarshalGQL(v interface{}) error {
func (e *FingerprintSubmissionType) UnmarshalGQL(v any) error {
str, ok := v.(string)
if !ok {
return fmt.Errorf("enums must be strings")
@@ -1815,6 +1959,20 @@ func (e FingerprintSubmissionType) MarshalGQL(w io.Writer) {
fmt.Fprint(w, strconv.Quote(e.String()))
}
func (e *FingerprintSubmissionType) UnmarshalJSON(b []byte) error {
s, err := strconv.Unquote(string(b))
if err != nil {
return err
}
return e.UnmarshalGQL(s)
}
func (e FingerprintSubmissionType) MarshalJSON() ([]byte, error) {
var buf bytes.Buffer
e.MarshalGQL(&buf)
return buf.Bytes(), nil
}
type GenderEnum string
const (
@@ -1847,7 +2005,7 @@ func (e GenderEnum) String() string {
return string(e)
}
func (e *GenderEnum) UnmarshalGQL(v interface{}) error {
func (e *GenderEnum) UnmarshalGQL(v any) error {
str, ok := v.(string)
if !ok {
return fmt.Errorf("enums must be strings")
@@ -1864,6 +2022,20 @@ func (e GenderEnum) MarshalGQL(w io.Writer) {
fmt.Fprint(w, strconv.Quote(e.String()))
}
func (e *GenderEnum) UnmarshalJSON(b []byte) error {
s, err := strconv.Unquote(string(b))
if err != nil {
return err
}
return e.UnmarshalGQL(s)
}
func (e GenderEnum) MarshalJSON() ([]byte, error) {
var buf bytes.Buffer
e.MarshalGQL(&buf)
return buf.Bytes(), nil
}
type GenderFilterEnum string
const (
@@ -1898,7 +2070,7 @@ func (e GenderFilterEnum) String() string {
return string(e)
}
func (e *GenderFilterEnum) UnmarshalGQL(v interface{}) error {
func (e *GenderFilterEnum) UnmarshalGQL(v any) error {
str, ok := v.(string)
if !ok {
return fmt.Errorf("enums must be strings")
@@ -1915,6 +2087,20 @@ func (e GenderFilterEnum) MarshalGQL(w io.Writer) {
fmt.Fprint(w, strconv.Quote(e.String()))
}
func (e *GenderFilterEnum) UnmarshalJSON(b []byte) error {
s, err := strconv.Unquote(string(b))
if err != nil {
return err
}
return e.UnmarshalGQL(s)
}
func (e GenderFilterEnum) MarshalJSON() ([]byte, error) {
var buf bytes.Buffer
e.MarshalGQL(&buf)
return buf.Bytes(), nil
}
type HairColorEnum string
const (
@@ -1955,7 +2141,7 @@ func (e HairColorEnum) String() string {
return string(e)
}
func (e *HairColorEnum) UnmarshalGQL(v interface{}) error {
func (e *HairColorEnum) UnmarshalGQL(v any) error {
str, ok := v.(string)
if !ok {
return fmt.Errorf("enums must be strings")
@@ -1972,6 +2158,20 @@ func (e HairColorEnum) MarshalGQL(w io.Writer) {
fmt.Fprint(w, strconv.Quote(e.String()))
}
func (e *HairColorEnum) UnmarshalJSON(b []byte) error {
s, err := strconv.Unquote(string(b))
if err != nil {
return err
}
return e.UnmarshalGQL(s)
}
func (e HairColorEnum) MarshalJSON() ([]byte, error) {
var buf bytes.Buffer
e.MarshalGQL(&buf)
return buf.Bytes(), nil
}
type NotificationEnum string
const (
@@ -2014,7 +2214,7 @@ func (e NotificationEnum) String() string {
return string(e)
}
func (e *NotificationEnum) UnmarshalGQL(v interface{}) error {
func (e *NotificationEnum) UnmarshalGQL(v any) error {
str, ok := v.(string)
if !ok {
return fmt.Errorf("enums must be strings")
@@ -2031,6 +2231,20 @@ func (e NotificationEnum) MarshalGQL(w io.Writer) {
fmt.Fprint(w, strconv.Quote(e.String()))
}
func (e *NotificationEnum) UnmarshalJSON(b []byte) error {
s, err := strconv.Unquote(string(b))
if err != nil {
return err
}
return e.UnmarshalGQL(s)
}
func (e NotificationEnum) MarshalJSON() ([]byte, error) {
var buf bytes.Buffer
e.MarshalGQL(&buf)
return buf.Bytes(), nil
}
type OperationEnum string
const (
@@ -2059,7 +2273,7 @@ func (e OperationEnum) String() string {
return string(e)
}
func (e *OperationEnum) UnmarshalGQL(v interface{}) error {
func (e *OperationEnum) UnmarshalGQL(v any) error {
str, ok := v.(string)
if !ok {
return fmt.Errorf("enums must be strings")
@@ -2076,6 +2290,20 @@ func (e OperationEnum) MarshalGQL(w io.Writer) {
fmt.Fprint(w, strconv.Quote(e.String()))
}
func (e *OperationEnum) UnmarshalJSON(b []byte) error {
s, err := strconv.Unquote(string(b))
if err != nil {
return err
}
return e.UnmarshalGQL(s)
}
func (e OperationEnum) MarshalJSON() ([]byte, error) {
var buf bytes.Buffer
e.MarshalGQL(&buf)
return buf.Bytes(), nil
}
type PerformerSortEnum string
const (
@@ -2114,7 +2342,7 @@ func (e PerformerSortEnum) String() string {
return string(e)
}
func (e *PerformerSortEnum) UnmarshalGQL(v interface{}) error {
func (e *PerformerSortEnum) UnmarshalGQL(v any) error {
str, ok := v.(string)
if !ok {
return fmt.Errorf("enums must be strings")
@@ -2131,6 +2359,20 @@ func (e PerformerSortEnum) MarshalGQL(w io.Writer) {
fmt.Fprint(w, strconv.Quote(e.String()))
}
func (e *PerformerSortEnum) UnmarshalJSON(b []byte) error {
s, err := strconv.Unquote(string(b))
if err != nil {
return err
}
return e.UnmarshalGQL(s)
}
func (e PerformerSortEnum) MarshalJSON() ([]byte, error) {
var buf bytes.Buffer
e.MarshalGQL(&buf)
return buf.Bytes(), nil
}
type RoleEnum string
const (
@@ -2173,7 +2415,7 @@ func (e RoleEnum) String() string {
return string(e)
}
func (e *RoleEnum) UnmarshalGQL(v interface{}) error {
func (e *RoleEnum) UnmarshalGQL(v any) error {
str, ok := v.(string)
if !ok {
return fmt.Errorf("enums must be strings")
@@ -2190,6 +2432,20 @@ func (e RoleEnum) MarshalGQL(w io.Writer) {
fmt.Fprint(w, strconv.Quote(e.String()))
}
func (e *RoleEnum) UnmarshalJSON(b []byte) error {
s, err := strconv.Unquote(string(b))
if err != nil {
return err
}
return e.UnmarshalGQL(s)
}
func (e RoleEnum) MarshalJSON() ([]byte, error) {
var buf bytes.Buffer
e.MarshalGQL(&buf)
return buf.Bytes(), nil
}
type SceneSortEnum string
const (
@@ -2220,7 +2476,7 @@ func (e SceneSortEnum) String() string {
return string(e)
}
func (e *SceneSortEnum) UnmarshalGQL(v interface{}) error {
func (e *SceneSortEnum) UnmarshalGQL(v any) error {
str, ok := v.(string)
if !ok {
return fmt.Errorf("enums must be strings")
@@ -2237,6 +2493,20 @@ func (e SceneSortEnum) MarshalGQL(w io.Writer) {
fmt.Fprint(w, strconv.Quote(e.String()))
}
func (e *SceneSortEnum) UnmarshalJSON(b []byte) error {
s, err := strconv.Unquote(string(b))
if err != nil {
return err
}
return e.UnmarshalGQL(s)
}
func (e SceneSortEnum) MarshalJSON() ([]byte, error) {
var buf bytes.Buffer
e.MarshalGQL(&buf)
return buf.Bytes(), nil
}
type SortDirectionEnum string
const (
@@ -2261,7 +2531,7 @@ func (e SortDirectionEnum) String() string {
return string(e)
}
func (e *SortDirectionEnum) UnmarshalGQL(v interface{}) error {
func (e *SortDirectionEnum) UnmarshalGQL(v any) error {
str, ok := v.(string)
if !ok {
return fmt.Errorf("enums must be strings")
@@ -2278,6 +2548,20 @@ func (e SortDirectionEnum) MarshalGQL(w io.Writer) {
fmt.Fprint(w, strconv.Quote(e.String()))
}
func (e *SortDirectionEnum) UnmarshalJSON(b []byte) error {
s, err := strconv.Unquote(string(b))
if err != nil {
return err
}
return e.UnmarshalGQL(s)
}
func (e SortDirectionEnum) MarshalJSON() ([]byte, error) {
var buf bytes.Buffer
e.MarshalGQL(&buf)
return buf.Bytes(), nil
}
type StudioSortEnum string
const (
@@ -2304,7 +2588,7 @@ func (e StudioSortEnum) String() string {
return string(e)
}
func (e *StudioSortEnum) UnmarshalGQL(v interface{}) error {
func (e *StudioSortEnum) UnmarshalGQL(v any) error {
str, ok := v.(string)
if !ok {
return fmt.Errorf("enums must be strings")
@@ -2321,6 +2605,20 @@ func (e StudioSortEnum) MarshalGQL(w io.Writer) {
fmt.Fprint(w, strconv.Quote(e.String()))
}
func (e *StudioSortEnum) UnmarshalJSON(b []byte) error {
s, err := strconv.Unquote(string(b))
if err != nil {
return err
}
return e.UnmarshalGQL(s)
}
func (e StudioSortEnum) MarshalJSON() ([]byte, error) {
var buf bytes.Buffer
e.MarshalGQL(&buf)
return buf.Bytes(), nil
}
type TagGroupEnum string
const (
@@ -2347,7 +2645,7 @@ func (e TagGroupEnum) String() string {
return string(e)
}
func (e *TagGroupEnum) UnmarshalGQL(v interface{}) error {
func (e *TagGroupEnum) UnmarshalGQL(v any) error {
str, ok := v.(string)
if !ok {
return fmt.Errorf("enums must be strings")
@@ -2364,6 +2662,20 @@ func (e TagGroupEnum) MarshalGQL(w io.Writer) {
fmt.Fprint(w, strconv.Quote(e.String()))
}
func (e *TagGroupEnum) UnmarshalJSON(b []byte) error {
s, err := strconv.Unquote(string(b))
if err != nil {
return err
}
return e.UnmarshalGQL(s)
}
func (e TagGroupEnum) MarshalJSON() ([]byte, error) {
var buf bytes.Buffer
e.MarshalGQL(&buf)
return buf.Bytes(), nil
}
type TagSortEnum string
const (
@@ -2390,7 +2702,7 @@ func (e TagSortEnum) String() string {
return string(e)
}
func (e *TagSortEnum) UnmarshalGQL(v interface{}) error {
func (e *TagSortEnum) UnmarshalGQL(v any) error {
str, ok := v.(string)
if !ok {
return fmt.Errorf("enums must be strings")
@@ -2407,6 +2719,20 @@ func (e TagSortEnum) MarshalGQL(w io.Writer) {
fmt.Fprint(w, strconv.Quote(e.String()))
}
func (e *TagSortEnum) UnmarshalJSON(b []byte) error {
s, err := strconv.Unquote(string(b))
if err != nil {
return err
}
return e.UnmarshalGQL(s)
}
func (e TagSortEnum) MarshalJSON() ([]byte, error) {
var buf bytes.Buffer
e.MarshalGQL(&buf)
return buf.Bytes(), nil
}
type TargetTypeEnum string
const (
@@ -2435,7 +2761,7 @@ func (e TargetTypeEnum) String() string {
return string(e)
}
func (e *TargetTypeEnum) UnmarshalGQL(v interface{}) error {
func (e *TargetTypeEnum) UnmarshalGQL(v any) error {
str, ok := v.(string)
if !ok {
return fmt.Errorf("enums must be strings")
@@ -2452,6 +2778,20 @@ func (e TargetTypeEnum) MarshalGQL(w io.Writer) {
fmt.Fprint(w, strconv.Quote(e.String()))
}
func (e *TargetTypeEnum) UnmarshalJSON(b []byte) error {
s, err := strconv.Unquote(string(b))
if err != nil {
return err
}
return e.UnmarshalGQL(s)
}
func (e TargetTypeEnum) MarshalJSON() ([]byte, error) {
var buf bytes.Buffer
e.MarshalGQL(&buf)
return buf.Bytes(), nil
}
type UserChangeEmailStatus string
const (
@@ -2484,7 +2824,7 @@ func (e UserChangeEmailStatus) String() string {
return string(e)
}
func (e *UserChangeEmailStatus) UnmarshalGQL(v interface{}) error {
func (e *UserChangeEmailStatus) UnmarshalGQL(v any) error {
str, ok := v.(string)
if !ok {
return fmt.Errorf("enums must be strings")
@@ -2501,6 +2841,20 @@ func (e UserChangeEmailStatus) MarshalGQL(w io.Writer) {
fmt.Fprint(w, strconv.Quote(e.String()))
}
func (e *UserChangeEmailStatus) UnmarshalJSON(b []byte) error {
s, err := strconv.Unquote(string(b))
if err != nil {
return err
}
return e.UnmarshalGQL(s)
}
func (e UserChangeEmailStatus) MarshalJSON() ([]byte, error) {
var buf bytes.Buffer
e.MarshalGQL(&buf)
return buf.Bytes(), nil
}
type UserVotedFilterEnum string
const (
@@ -2529,7 +2883,7 @@ func (e UserVotedFilterEnum) String() string {
return string(e)
}
func (e *UserVotedFilterEnum) UnmarshalGQL(v interface{}) error {
func (e *UserVotedFilterEnum) UnmarshalGQL(v any) error {
str, ok := v.(string)
if !ok {
return fmt.Errorf("enums must be strings")
@@ -2546,6 +2900,20 @@ func (e UserVotedFilterEnum) MarshalGQL(w io.Writer) {
fmt.Fprint(w, strconv.Quote(e.String()))
}
func (e *UserVotedFilterEnum) UnmarshalJSON(b []byte) error {
s, err := strconv.Unquote(string(b))
if err != nil {
return err
}
return e.UnmarshalGQL(s)
}
func (e UserVotedFilterEnum) MarshalJSON() ([]byte, error) {
var buf bytes.Buffer
e.MarshalGQL(&buf)
return buf.Bytes(), nil
}
type ValidSiteTypeEnum string
const (
@@ -2572,7 +2940,7 @@ func (e ValidSiteTypeEnum) String() string {
return string(e)
}
func (e *ValidSiteTypeEnum) UnmarshalGQL(v interface{}) error {
func (e *ValidSiteTypeEnum) UnmarshalGQL(v any) error {
str, ok := v.(string)
if !ok {
return fmt.Errorf("enums must be strings")
@@ -2589,6 +2957,20 @@ func (e ValidSiteTypeEnum) MarshalGQL(w io.Writer) {
fmt.Fprint(w, strconv.Quote(e.String()))
}
func (e *ValidSiteTypeEnum) UnmarshalJSON(b []byte) error {
s, err := strconv.Unquote(string(b))
if err != nil {
return err
}
return e.UnmarshalGQL(s)
}
func (e ValidSiteTypeEnum) MarshalJSON() ([]byte, error) {
var buf bytes.Buffer
e.MarshalGQL(&buf)
return buf.Bytes(), nil
}
type VoteStatusEnum string
const (
@@ -2623,7 +3005,7 @@ func (e VoteStatusEnum) String() string {
return string(e)
}
func (e *VoteStatusEnum) UnmarshalGQL(v interface{}) error {
func (e *VoteStatusEnum) UnmarshalGQL(v any) error {
str, ok := v.(string)
if !ok {
return fmt.Errorf("enums must be strings")
@@ -2640,6 +3022,20 @@ func (e VoteStatusEnum) MarshalGQL(w io.Writer) {
fmt.Fprint(w, strconv.Quote(e.String()))
}
func (e *VoteStatusEnum) UnmarshalJSON(b []byte) error {
s, err := strconv.Unquote(string(b))
if err != nil {
return err
}
return e.UnmarshalGQL(s)
}
func (e VoteStatusEnum) MarshalJSON() ([]byte, error) {
var buf bytes.Buffer
e.MarshalGQL(&buf)
return buf.Bytes(), nil
}
type VoteTypeEnum string
const (
@@ -2672,7 +3068,7 @@ func (e VoteTypeEnum) String() string {
return string(e)
}
func (e *VoteTypeEnum) UnmarshalGQL(v interface{}) error {
func (e *VoteTypeEnum) UnmarshalGQL(v any) error {
str, ok := v.(string)
if !ok {
return fmt.Errorf("enums must be strings")
@@ -2688,3 +3084,17 @@ func (e *VoteTypeEnum) UnmarshalGQL(v interface{}) error {
func (e VoteTypeEnum) MarshalGQL(w io.Writer) {
fmt.Fprint(w, strconv.Quote(e.String()))
}
func (e *VoteTypeEnum) UnmarshalJSON(b []byte) error {
s, err := strconv.Unquote(string(b))
if err != nil {
return err
}
return e.UnmarshalGQL(s)
}
func (e VoteTypeEnum) MarshalJSON() ([]byte, error) {
var buf bytes.Buffer
e.MarshalGQL(&buf)
return buf.Bytes(), nil
}

View File

@@ -1,20 +0,0 @@
package graphql
import "github.com/99designs/gqlgen/graphql"
// Override for generated struct due to mistaken omitempty
// https://github.com/Yamashou/gqlgenc/issues/77
type SceneDraftInput struct {
ID *string `json:"id,omitempty"`
Title *string `json:"title,omitempty"`
Code *string `json:"code,omitempty"`
Details *string `json:"details,omitempty"`
Director *string `json:"director,omitempty"`
URL *string `json:"url,omitempty"`
Date *string `json:"date,omitempty"`
Studio *DraftEntityInput `json:"studio,omitempty"`
Performers []*DraftEntityInput `json:"performers"`
Tags []*DraftEntityInput `json:"tags,omitempty"`
Image *graphql.Upload `json:"image,omitempty"`
Fingerprints []*FingerprintInput `json:"fingerprints"`
}

View File

@@ -183,7 +183,7 @@ func (c Client) sceneFragmentToScrapedScene(ctx context.Context, s *graphql.Scen
if len(s.Images) > 0 {
// TODO - #454 code sorts images by aspect ratio according to a wanted
// orientation. I'm just grabbing the first for now
ss.Image = getFirstImage(ctx, c.getHTTPClient(), s.Images)
ss.Image = getFirstImage(ctx, c.httpClient, s.Images)
}
ss.URLs = make([]string, len(s.Urls))