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 package output breaks if in sub directory #30

Closed randallmlough closed 4 years ago

randallmlough commented 4 years ago

If I attempt to put the outputted helpers dir as a sub directory, for example graph/helpers then the helpers package name will be package graph/helpers which obviously doesn't work


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

    convertHelpersDir := "graph/helpers"
    sqlboilerDir := "models"
    gqlgenModelDir := "graphql_models"

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

       // ...
RichardLindhout commented 4 years ago

Thanks for your work. Let me know if this works in new release or on master

RichardLindhout commented 4 years ago

Should be fixed in v2.1.0. Thanks for your PR! 👌