clientoptions

package
v0.2.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 19, 2024 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

clientoptions is used to transfer information conveyed in a URL into a slice of grp.DialOption.

Overview

More information at https://github.com/senzing-garage/go-grpcing

Examples

Examples of use can be seen in https://github.com/senzing-garage/go-grpcing/blob/main/clientoptions/clientoptions_test.go

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetDialOptions

func GetDialOptions(ctx context.Context, parsedUrl url.URL) ([]grpc.DialOption, error)

The GetDialOptions function returns a slice of grpc.DialOption(s) from a parsed URL.

Input

  • ctx: A context to control lifecycle.
  • parsedUrl: A parsed URL.

Output

  • grpcDialOptions: A slice of configuration options for gRPC server/client
Example (Simple)
// For more information, visit https://github.com/senzing-garage/go-grpcing/blob/main/clientoptions/clientoptions_test.go
ctx := context.TODO()
grpcUrl := "grpc://localhost:8258"
parsedUrl, err := url.Parse(grpcUrl)
if err != nil {
	fmt.Println(err)
}
grpcDialOptions, err := GetDialOptions(ctx, *parsedUrl)
if err != nil {
	fmt.Println(err)
}
fmt.Println(len(grpcDialOptions))
Output:

1

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL