Skip to content

incu6us/gostruct2graphql

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 

Repository files navigation

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,
      },},
})

About

Go structure to GraphQL object

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages