From d80d17e9e00e4d8ac9cadc1f869e4629874c2e87 Mon Sep 17 00:00:00 2001 From: Richard Lindhout Date: Wed, 30 Dec 2020 12:33:00 +0100 Subject: [PATCH] Create output directory if not exist + instruction improvement --- README.md | 57 ++++++++++++++++++++++++++++--------------------------- 1 file changed, 29 insertions(+), 28 deletions(-) diff --git a/README.md b/README.md index 9624198..742be9f 100644 --- a/README.md +++ b/README.md @@ -167,6 +167,7 @@ import ( func main() { + output := gbgen.Config{ Directory: "helpers", // supports root or sub directories PackageName: "helpers", @@ -215,34 +216,34 @@ func main() { backend, frontend, gbgen.ResolverPluginConfig{ - // Authorization scopes can be used to override e.g. userId, organizationId, tenantId - // This will be resolved used the provided ScopeResolverName if the result of the AddTrigger=true - // You would need this if you don't want to require these fields in your schema but you want to add them - // to the db model. - // If you do have these fields in your schema but want them authorized you could use a gqlgen directive - //AuthorizationScopes: []*gbgen.AuthorizationScope{ - // { - // ImportPath: "github.com/yourcompany/backend/auth", - // ImportAlias: "auth", - // ScopeResolverName: "UserIDFromContext", // function which is called with the context of the resolver - // BoilerColumnName: "UserID", - // - // AddHook: func(model *gbgen.BoilerModel, resolver *gbgen.Resolver, templateKey string) bool { - // // fmt.Println(templateKey) - // // templateKey contains a unique where the resolver tries to add something - // // e.g. - // // most of the time you can ignore this - // var addResolver bool - // for _, field := range model.Fields { - // if field.Name == "UserID" { - // addResolver = true - // } - // } - // return addResolver - // }, - // }, - //}, - }, + // Authorization scopes can be used to override e.g. userId, organizationId, tenantId + // This will be resolved used the provided ScopeResolverName if the result of the AddTrigger=true + // You would need this if you don't want to require these fields in your schema but you want to add them + // to the db model. + // If you do have these fields in your schema but want them authorized you could use a gqlgen directive + //AuthorizationScopes: []*gbgen.AuthorizationScope{ + // { + // ImportPath: "github.com/yourcompany/backend/auth", + // ImportAlias: "auth", + // ScopeResolverName: "UserIDFromContext", // function which is called with the context of the resolver + // BoilerColumnName: "UserID", + // + // AddHook: func(model *gbgen.BoilerModel, resolver *gbgen.Resolver, templateKey string) bool { + // // fmt.Println(templateKey) + // // templateKey contains a unique where the resolver tries to add something + // // e.g. + // // most of the time you can ignore this + // var addResolver bool + // for _, field := range model.Fields { + // if field.Name == "UserID" { + // addResolver = true + // } + // } + // return addResolver + // }, + // }, + //}, + }, )), ); err != nil { fmt.Println("error while trying generate resolver and converts")