MCPcopy
hub / github.com/sqlc-dev/sqlc / NewClient

Function NewClient

internal/quickdb/rpc.go:34–57  ·  view source on GitHub ↗
(project, token string, opts ...Option)

Source from the content-addressed store, hash-verified

32}
33
34func NewClient(project, token string, opts ...Option) (pb.QuickClient, error) {
35 var o options
36 for _, apply := range opts {
37 apply(&o)
38 }
39
40 dialOpts := []grpc.DialOption{
41 grpc.WithTransportCredentials(credentials.NewTLS(&tls.Config{})),
42 grpc.WithPerRPCCredentials(basic.NewPerRPCCredentials(project, token)),
43 grpc.WithUnaryInterceptor(rpc.UnaryInterceptor),
44 }
45
46 hostname := o.hostname
47 if hostname == "" {
48 hostname = defaultHostname
49 }
50
51 conn, err := grpc.Dial(hostname+":443", dialOpts...)
52 if err != nil {
53 return nil, err
54 }
55
56 return pb.NewQuickClient(conn), nil
57}

Callers 1

NewClientFromConfigFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected