cmd

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: May 5, 2021 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Request

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

Request is an abstraction over the actual command with flags. This abstraction is useful because it allows us to create cmd applications in same way we would create a HTTP server application. Gofr's http.Request is another such abstraction.

func NewRequest

func NewRequest(args []string) *Request

NewRequest creates a Request from a list of arguments. This way we can simulate running a command without actually doing it. It makes the code more testable this way.

func (*Request) Bind

func (r *Request) Bind(i interface{}) error

func (*Request) Context

func (r *Request) Context() context.Context

func (*Request) Header

func (r *Request) Header(key string) string

func (*Request) Param

func (r *Request) Param(key string) string

Param returns the value of the parameter for key.

func (*Request) PathParam

func (r *Request) PathParam(key string) string

PathParam returns the value of the parameter for key. This is equivalent to Param.

type Responder

type Responder struct{}

func (*Responder) Respond

func (r *Responder) Respond(data interface{}, err error)

Jump to

Keyboard shortcuts

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