Go API
Use one of the standard implementations or create one yourself.
Introduction
Semaphore exposes most of the internally used methods. This allows developers to create their own custom implementations. Please check out the go docs.
$ go get github.com/jexia/maestropackage main
import (
"github.com/jexia/maestro"
"github.com/jexia/maestro/codec/json"
"github.com/jexia/maestro/codec/proto"
"github.com/jexia/maestro/definitions/hcl"
"github.com/jexia/maestro/protocol/graphql"
"github.com/jexia/maestro/protocol/http"
"github.com/jexia/maestro/schema/protoc"
"github.com/jexia/maestro/specs"
)
func main() {
protobuffers, err := protoc.Collect([]string{"./"}, "./*")
if err != nil {
// handle err
}
client, err := maestro.New(
maestro.WithListener(graphql.NewListener(":9090", specs.Options{})),
maestro.WithListener(http.NewListener(":8080", specs.Options{})),
maestro.WithDefinitions(hcl.DefinitionResolver("./*")),
maestro.WithSchema(protobuffers),
maestro.WithCodec(json.NewConstructor()),
maestro.WithCodec(proto.NewConstructor()),
maestro.WithCaller(http.NewCaller()),
)
if err != nil {
// handle err
}
err = client.Serve()
if err != nil {
// handle err
}
}Last updated