Bladeren bron

GraphQL connection

- to follow up graphql specs: remove total from PageInfo
Alexey Kim 1 jaar geleden
bovenliggende
commit
8075d33695
4 gewijzigde bestanden met toevoegingen van 14 en 14 verwijderingen
  1. 0 2
      go.sum
  2. 0 1
      model/connection.go
  3. 0 1
      model/page_info.go
  4. 14 10
      model/page_info_easyjson.go

+ 0 - 2
go.sum

@@ -117,8 +117,6 @@ golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPh
 golang.org/x/crypto v0.0.0-20220622213112-05595931fe9d/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4=
 golang.org/x/crypto v0.12.0 h1:tFM/ta59kqch6LlvYnPa0yx5a83cL2nHflFhYKvv9Yk=
 golang.org/x/crypto v0.12.0/go.mod h1:NF0Gs7EO5K4qLn+Ylc+fih8BSTeIjAP05siRnAh98yw=
-golang.org/x/exp v0.0.0-20220303212507-bbda1eaf7a17 h1:3MTrJm4PyNL9NBqvYDSj3DHl46qQakyfqfWo4jgfaEM=
-golang.org/x/exp v0.0.0-20220303212507-bbda1eaf7a17/go.mod h1:lgLbSvA5ygNOMpwM/9anMpWVlVJ7Z+cHWq/eFuinpGE=
 golang.org/x/exp v0.0.0-20230817173708-d852ddb80c63 h1:m64FZMko/V45gv0bNmrNYoDEq8U5YUhetc9cBWKS1TQ=
 golang.org/x/exp v0.0.0-20230817173708-d852ddb80c63/go.mod h1:0v4NqG35kSWCMzLaMeX+IQrlSnVE/bqGSyC2cz/9Le8=
 golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=

+ 0 - 1
model/connection.go

@@ -32,7 +32,6 @@ func (c *Connection[T]) Grain(after, before *string) error {
 	})
 
 	c.PageInfo = &PageInfo{
-		Total:       len(edges),
 		StartCursor: lo.ToPtr(edges[0]),
 		EndCursor:   lo.ToPtr(edges[(len(edges) - 1)]),
 	}

+ 0 - 1
model/page_info.go

@@ -2,7 +2,6 @@ package model
 
 //easyjson:json
 type PageInfo struct {
-	Total           int     `json:"total"`
 	StartCursor     *string `json:"start_cursor,omitempty"`
 	EndCursor       *string `json:"end_cursor,omitempty"`
 	HasNextPage     bool    `json:"has_next_page"`

+ 14 - 10
model/page_info_easyjson.go

@@ -36,8 +36,6 @@ func easyjson142f204aDecodeGitBeejayKimCraftApiModel(in *jlexer.Lexer, out *Page
 			continue
 		}
 		switch key {
-		case "total":
-			out.Total = int(in.Int())
 		case "start_cursor":
 			if in.IsNull() {
 				in.Skip()
@@ -76,24 +74,30 @@ func easyjson142f204aEncodeGitBeejayKimCraftApiModel(out *jwriter.Writer, in Pag
 	out.RawByte('{')
 	first := true
 	_ = first
-	{
-		const prefix string = ",\"total\":"
-		out.RawString(prefix[1:])
-		out.Int(int(in.Total))
-	}
 	if in.StartCursor != nil {
 		const prefix string = ",\"start_cursor\":"
-		out.RawString(prefix)
+		first = false
+		out.RawString(prefix[1:])
 		out.String(string(*in.StartCursor))
 	}
 	if in.EndCursor != nil {
 		const prefix string = ",\"end_cursor\":"
-		out.RawString(prefix)
+		if first {
+			first = false
+			out.RawString(prefix[1:])
+		} else {
+			out.RawString(prefix)
+		}
 		out.String(string(*in.EndCursor))
 	}
 	{
 		const prefix string = ",\"has_next_page\":"
-		out.RawString(prefix)
+		if first {
+			first = false
+			out.RawString(prefix[1:])
+		} else {
+			out.RawString(prefix)
+		}
 		out.Bool(bool(in.HasNextPage))
 	}
 	{