You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
20 lines
479 B
20 lines
479 B
package grpc |
|
|
|
import ( |
|
"context" |
|
|
|
"next.orly.dev/pkg/database" |
|
) |
|
|
|
func init() { |
|
database.RegisterGRPCFactory(NewFromConfig) |
|
} |
|
|
|
// NewFromConfig creates a new gRPC database client from the database config. |
|
func NewFromConfig(ctx context.Context, cancel context.CancelFunc, cfg *database.DatabaseConfig) (database.Database, error) { |
|
clientCfg := &ClientConfig{ |
|
ServerAddress: cfg.GRPCServerAddress, |
|
ConnectTimeout: cfg.GRPCConnectTimeout, |
|
} |
|
return New(ctx, clientCfg) |
|
}
|
|
|