Skip to content

Latest commit

 

History

History
77 lines (70 loc) · 1.93 KB

README.md

File metadata and controls

77 lines (70 loc) · 1.93 KB

gostruct2graphql

Put your struct to structs/structs.go and choose it in the main method of main.go, like:

...
func main() {

	getRootDescription(structs.Repository{})
	getRootDescription(structs.Test{})

}

then, run the app:

go run main.go

Response

// Generated by gostruct2graphql
RepositoryGqlType := graphql.NewList(graphql.NewObject(graphql.ObjectConfig{
		  Name: "Repository",
		  Fields: graphql.Fields{"CacheMaxSeconds": &graphql.Field{
        Type: graphql.Int,
      },"CurrentTime": &graphql.Field{
        Type: graphql.Int,
      },"Doc": &graphql.Field{
				Type: graphql.NewObject(graphql.ObjectConfig{
					Name: "Doc",
					Fields: graphql.Fields{"TropData": &graphql.Field{
				Type: graphql.NewObject(graphql.ObjectConfig{
					Name: "TropData",
					Fields: graphql.Fields{"Two016": &graphql.Field{
				Type: graphql.NewList(graphql.NewObject(graphql.ObjectConfig{
					Name: "Two016",
					Fields: graphql.Fields{"Active": &graphql.Field{
        Type: graphql.Boolean,
      },"Category": &graphql.Field{
        Type: graphql.String,
      },"Status": &graphql.Field{
        Type: graphql.String,
      },"TropID": &graphql.Field{
        Type: graphql.String,
      },"TropName": &graphql.Field{
        Type: graphql.String,
      },},
      })),
    },},
      }),
    },"TropHdr": &graphql.Field{
				Type: graphql.NewObject(graphql.ObjectConfig{
					Name: "TropHdr",
					Fields: graphql.Fields{"TNum": &graphql.Field{
        Type: graphql.Int,
      },},
      }),
    },},
      }),
    },"GeneratedTime": &graphql.Field{
        Type: graphql.Int,
      },"ID": &graphql.Field{
        Type: graphql.String,
      },"Status": &graphql.Field{
        Type: graphql.Int,
      },},
}))

// Generated by gostruct2graphql
TestGqlType := graphql.NewObject(graphql.ObjectConfig{
		  Name: "Test",
		  Fields: graphql.Fields{"Stringer": &graphql.Field{
        Type: graphql.String,
      },},
})