web-ridge / gqlgen-sqlboiler

This is a plugin for gqlgen to generate converts + filter queries and resolvers for sqlboiler
MIT License
74 stars 13 forks source link

Helpers funcs always assumes graphql_models as the package #31

Closed randallmlough closed 4 years ago

randallmlough commented 4 years ago

It would be nice to be able to customize the package the helper package / funcs return. From what I can tell it will always assume the package name is graphql_models even if I change the directory to be app as shown below.

func main() {
    cfg, err := config.LoadConfigFromDefaultLocations()
    if err != nil {
        fmt.Fprintln(os.Stderr, "failed to load config", err.Error())
        os.Exit(2)
    }

    convertHelpersDir := "helpers"
    sqlboilerDir := "models"
    gqlgenModelDir := "app"

    err = api.Generate(cfg,
        api.AddPlugin(gbgen.NewConvertPlugin(
            convertHelpersDir, // directory where convert.go, convert_input.go and preload.go should live
            sqlboilerDir,      // directory where sqlboiler files are put
            gqlgenModelDir,    // directory where gqlgen models live
        )),

If this package name could be customized or at least respect the gqlgenModelDir variable that would be nice https://github.com/web-ridge/gqlgen-sqlboiler/blob/master/convert.gotpl#L31

RichardLindhout commented 4 years ago

You're right it should be fixed in your PR so thanks for that!

RichardLindhout commented 4 years ago

Fixed in v2.1.0. Thanks for your PR! 👌