Documentation
¶
Overview ¶
Package direct implements a backend wrapper which allows to connect clients to a backend directly bypassing grpc servers. This is intended either for testing, use at own risk!
Example ¶
package main
import (
"context"
"github.com/bsm/accord"
"github.com/bsm/accord/backend/direct"
"github.com/bsm/accord/backend/postgres"
)
func main() {
ctx := context.Background()
// Open a backend connection.
backend, err := postgres.Open(ctx, "postgres", "postgres://127.0.0.1:5432/accord")
if err != nil {
panic(err)
}
defer backend.Close()
// Bypass gRPC servers and connect a client directly to a backend (not recommended).
client, err := accord.RPCClient(ctx, direct.Connect(backend), nil)
if err != nil {
panic(err)
}
defer client.Close()
// ... use client
}
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.