summaryrefslogtreecommitdiff
path: root/vendor/github.com/authzed/spicedb/internal/grpchelpers/grpchelpers.go
blob: de91a0fbb8a36ada2fe44eee2cbfbf12722388fb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
package grpchelpers

import (
	"context"

	"google.golang.org/grpc"
)

// DialAndWait creates a new client connection to the target and blocks until the connection is ready.
func DialAndWait(ctx context.Context, target string, opts ...grpc.DialOption) (*grpc.ClientConn, error) {
	// TODO: move to NewClient
	opts = append(opts, grpc.WithBlock())         // nolint: staticcheck
	return grpc.DialContext(ctx, target, opts...) // nolint: staticcheck
}

// Dial creates a new client connection to the target.
func Dial(ctx context.Context, target string, opts ...grpc.DialOption) (*grpc.ClientConn, error) {
	// TODO: move to NewClient
	return grpc.DialContext(ctx, target, opts...) // nolint: staticcheck
}