Documentation ¶
Overview ¶
Package usecase provides all use-case logics used from each mode. Clients of usecase package must call Inject before all function calls in usecase package.
Index ¶
- func AddHeader(k, v string)
- func CallRPC(ctx context.Context, w io.Writer, rpcName string) error
- func CallRPCInteractively(ctx context.Context, w io.Writer, rpcName string, ...) error
- func Clear()
- func FormatDescriptor(symbol string) (string, error)
- func FormatHeaders() (string, error)
- func FormatMessages() (string, error)
- func FormatMethod(fqmn string) (string, error)
- func FormatMethods() (string, error)
- func FormatPackages() (string, error)
- func FormatServiceDescriptors() (string, error)
- func FormatServices() (string, error)
- func FormatServicesOld() (string, error)
- func GetDomainSourceName() string
- func GetTypeDescriptor(typeName string) (interface{}, error)
- func Inject(deps Dependencies)
- func InjectPartially(deps Dependencies)
- func ListHeaders() grpc.Headers
- func ListPackages() []string
- func ListRPCs(svcName string) ([]*grpc.RPC, error)
- func ListServices() []string
- func ListServicesOld() []string
- func ParseFullyQualifiedMethodName(fqmn string) (fqsn, method string, err error)
- func RemoveHeader(k string)
- func UsePackage(pkgName string) error
- func UseService(svcName string) error
- type Dependencies
- type ErrorCode
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CallRPC ¶ added in v0.8.0
CallRPC constructs a request with input source such that prompt inputting, stdin or a file. After that, it sends the request to the gRPC server and decodes the response body to res. Note that req and res must be JSON-decodable structs. The output is written to w.
func CallRPCInteractively ¶ added in v0.9.0
func Clear ¶ added in v0.8.0
func Clear()
Clear clears all dependencies and states. Usually, it is used for unit testing.
func FormatDescriptor ¶ added in v0.9.0
FormatDescriptor formats the descriptor of the passed symbol.
func FormatHeaders ¶ added in v0.8.4
FormatHeaders formats all package names.
func FormatMessages ¶ added in v0.8.4
FormatMessages formats all package names.
func FormatMethod ¶ added in v0.9.0
FormatMethod formats a method.
func FormatMethods ¶ added in v0.9.0
FormatMethods formats all method names.
func FormatPackages ¶ added in v0.8.4
FormatPackages formats all package names.
func FormatServiceDescriptors ¶ added in v0.9.0
FormatServiceDescriptors formats all service descriptors the spec loaded.
func FormatServices ¶ added in v0.8.4
FormatServices formats all service names the spec loaded.
func FormatServicesOld ¶ added in v0.9.0
FormatServicesOld formats all package names. Deprecated: dropped in the next major release.
func GetDomainSourceName ¶ added in v0.8.0
func GetDomainSourceName() string
func GetTypeDescriptor ¶ added in v0.8.0
GetTypeDescriptor gets the descriptor of a type which belongs to the currently selected package.
func Inject ¶ added in v0.8.0
func Inject(deps Dependencies)
Inject corresponds an implementation to an interface type. Inject clears the previous states if it exists.
func InjectPartially ¶ added in v0.9.0
func InjectPartially(deps Dependencies)
InjectPartially is almost same as the Inject, but injects only non-nil dependencies.
func ListHeaders ¶ added in v0.8.0
func ListPackages ¶ added in v0.8.0
func ListPackages() []string
ListPackages lists all package names.
func ListRPCs ¶ added in v0.8.0
ListRPCs lists all RPC belong to the selected service. If svcName is empty, the currently selected service will be used. In this case, ListRPCs doesn't modify the currently selected service.
func ListServices ¶ added in v0.8.0
func ListServices() []string
ListServices returns the loaded fully-qualified service names.
func ListServicesOld ¶ added in v0.9.0
func ListServicesOld() []string
ListServicesOld returns the services belong to the selected package. The returned service names are NOT fully-qualified.
func ParseFullyQualifiedMethodName ¶ added in v0.9.0
ParseFullyQualifiedMethodName parses the passed fully-qualified method as fully-qualified service name and method name. ParseFullyQualifiedMethodName may return these errors:
- An error described in idl.Spec.RPC method returns.
- An error if fqmn is not a valid fully-qualified method name form.
func RemoveHeader ¶ added in v0.8.0
func RemoveHeader(k string)
func UsePackage ¶ added in v0.8.0
UsePackage modifies pkgName as the currently selected package. UsePackage may return these errors:
- idl.ErrUnknownPackageName: pkgName is not in loaded packages.
func UseService ¶ added in v0.8.0
UseService modifies svcName as the currently selected service. UseService may return these errors:
- ErrPackageUnselected: REPL never call UsePackage.
- ErrUnknownServiceName: svcName is not in loaded services.
Types ¶
type Dependencies ¶ added in v0.9.0
Source Files ¶
- call_rpc.go
- format_descriptor.go
- format_headers.go
- format_messages.go
- format_method.go
- format_methods.go
- format_packages.go
- format_service_descriptors.go
- format_services.go
- format_services_old.go
- get_dsn.go
- get_type_descriptor.go
- header.go
- list_packages.go
- list_rpcs.go
- list_services.go
- list_services_old.go
- parse_method.go
- use_package.go
- use_service.go
- usecase.go