typesInit flag
This commit is contained in:
parent
48f770f703
commit
48c50a5b7e
@ -13,6 +13,7 @@ import (
|
|||||||
types "git.kapelle.org/niklas/s3browser/internal/types"
|
types "git.kapelle.org/niklas/s3browser/internal/types"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
var typesInit bool = false
|
||||||
var graphqlDirType *graphql.Object
|
var graphqlDirType *graphql.Object
|
||||||
var graphqlFileType *graphql.Object
|
var graphqlFileType *graphql.Object
|
||||||
var graphqlLoginResultType *graphql.Object
|
var graphqlLoginResultType *graphql.Object
|
||||||
@ -246,6 +247,8 @@ func GraphqlTypes() {
|
|||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
|
typesInit = true
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//loadFile helper func for using the dataloader to get a file
|
//loadFile helper func for using the dataloader to get a file
|
||||||
|
@ -15,6 +15,10 @@ import (
|
|||||||
//GraphqlSchema generate the schema with its root query and mutation
|
//GraphqlSchema generate the schema with its root query and mutation
|
||||||
func GraphqlSchema() (graphql.Schema, error) {
|
func GraphqlSchema() (graphql.Schema, error) {
|
||||||
|
|
||||||
|
if !typesInit {
|
||||||
|
GraphqlTypes()
|
||||||
|
}
|
||||||
|
|
||||||
queryFields := graphql.Fields{
|
queryFields := graphql.Fields{
|
||||||
"files": &graphql.Field{
|
"files": &graphql.Field{
|
||||||
Type: graphql.NewNonNull(graphql.NewList(graphql.NewNonNull(graphqlFileType))),
|
Type: graphql.NewNonNull(graphql.NewList(graphql.NewNonNull(graphqlFileType))),
|
||||||
|
Loading…
Reference in New Issue
Block a user