cli

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Sep 14, 2023 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DefaultPort is the default port used to serve the Connector.
	DefaultPort = uint16(8000)
)

Variables

This section is empty.

Functions

func Main

func Main()

Main is the entrypoint for the CLI. Call Main from an actual main function.

Types

type App

type App struct {
	// contains filtered or unexported fields
}

App is the CLI application.

func New

func New(opts ...clifactory.Option) *App

New returns the CLI App.

func (*App) Factory

func (app *App) Factory() *clifactory.Factory

Factory returns the CLI Factory.

func (*App) Root

func (app *App) Root() *cobra.Command

Root returns the root command.

func (*App) Run

func (app *App) Run() error

Run runs the app.

type Connector

type Connector struct {
	// contains filtered or unexported fields
}

Connector provides the gRPC server for CLI commands.

func NewConnector

func NewConnector(svc *projection.Service) *Connector

NewConnector returns a new CLI Connector.

func (*Connector) Serve

func (c *Connector) Serve(ctx context.Context, opts ...ServeOption) error

Serve serves the Connector until ctx is canceled.

c := cli.NewConnector(...)
err := c.Serve(context.TODO(), cli.Port(8080))

type ServeOption

type ServeOption func(*serveConfig)

ServeOption is an option for serving a Connetor.

func Listener

func Listener(lis net.Listener) ServeOption

Listener returns a ServeOption that provides a Connector with a custom Listener. When a Listener is provided, the Port ServeOption has no effect.

func Port

func Port(p uint16) ServeOption

Port returns a ServeOption that specifies the port to use when creating the Listener for a Connector. Default port is 8000. Port has no effect when providing a custom Listener through the Listener ServeOption.

func Server

func Server(srv *grpc.Server) ServeOption

Server returns a ServeOption that specifies the underlying grpc.Server to use.

Directories

Path Synopsis
internal

Jump to

Keyboard shortcuts

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