bramble
bramble copied to clipboard
Impossible to use as a library
Hi team,
I would like to use bramble as a library. It's currently impossible because some types are not exported.
- As per the docs, I should be able to implement
bramble.Plugin
without having to embedbramble.BasePlugin
. This is currently impossible becausebramble.queryExecution
is not exported, but is present in the signature ofbramble.Plugin.ModifyExtensions
method. - To create a custom
main
function, I need to create an instance ofbramble.Gateway
. This is impossible because neitherbramble.newExecutableSchema
norbramble.ExecutableSchema.plugins
are exported.
Could you please export the listed types/functions so bramble
could be used as a library?
Thanks for the help!
@joshiefu now that the two PRs are merged, would it be possible to post an example of how to use the project as a library? For example, would it be setting up a custom "main.go" that pulls in a different set of plugins and middleware?
@sodabrew that is the idea, at Movio we already have a separate main.go
that loads in some extra plugins which is essentially this:
package main
import (
"github.com/movio/bramble"
_ "github.com/movio/bramble/plugins"
_ "github.com/movio/internal-repo/bramble/plugins"
)
func main() {
bramble.Main()
}
That PR was the first in a few changes we want to make so it would be possible to add bramble as a http.Handler
on a http.ServeMux
.
We'll work on getting an example up as I think that would be useful.
Related: https://github.com/movio/bramble/issues/98