helper

package
v0.0.0-...-908e76c Latest Latest
Warning

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

Go to latest
Published: Jul 3, 2023 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CodeOf

func CodeOf(err error) connect.Code

CodeOf returns connect.CodeOf(err) if err is not nil. Otherwise, returns 0 for OK. connect.CodeOf(err) returns codes.Unknown if err is nil, but it is not useful for testing.

func ConnectEqual

func ConnectEqual[T any](x *T) *connectMatcher[T]

func GetMsg

func GetMsg[T any](v *connect.Request[T]) *T

GetMsg returns v.Msg if res is not nil. Otherwise, returns nil.

Original grpc-go code implements nil check in generated code to access message field and able to get default value, but connect-go does not because connect.Request.Msg panics if it is nil.

``` var foo *T = nil foo.GetCluster() // ok

var bar connect.Request[T] = nil bar.Msg.GetCluster() // panic ```

To avoid this panic, this function is introduced.

``` var bar connect.Request[T] = nil GetMsg(bar).GetCluster() // ok ```

func GetResponseMsg

func GetResponseMsg[T any](v *connect.Response[T]) *T

GetResponseMsg returns v.Msg if res is not nil. Otherwise, returns nil. See GetMsg for details.

func ProtoEqual

func ProtoEqual(x proto.Message) gomock.Matcher

ProtoEqual returns a gomock.Matcher for proto.Message.

Types

type Cluster

type Cluster = connect.Response[v1alpha.Cluster]

workaround for generating gomock with generics failed parsing arguments: don't know how to parse type *ast.IndexExpr

type CreateClusterRequest

type CreateClusterRequest = connect.Request[v1alpha.CreateClusterRequest]

workaround for generating gomock with generics failed parsing arguments: don't know how to parse type *ast.IndexExpr

type DeleteClusterRequest

type DeleteClusterRequest = connect.Request[v1alpha.DeleteClusterRequest]

workaround for generating gomock with generics failed parsing arguments: don't know how to parse type *ast.IndexExpr

type Empty

type Empty = connect.Response[emptypb.Empty]

workaround for generating gomock with generics failed parsing arguments: don't know how to parse type *ast.IndexExpr

type GetClusterRequest

type GetClusterRequest = connect.Request[v1alpha.GetClusterRequest]

workaround for generating gomock with generics failed parsing arguments: don't know how to parse type *ast.IndexExpr

type KeServiceClient

type KeServiceClient interface {
	CreateCluster(context.Context, *CreateClusterRequest) (*Cluster, error)
	GetCluster(context.Context, *GetClusterRequest) (*Cluster, error)
	DeleteCluster(context.Context, *DeleteClusterRequest) (*Empty, error)
	ListCluster(context.Context, *ListClusterRequest) (*ListClusterResponse, error)
	UpdateCluster(context.Context, *UpdateClusterRequest) (*Cluster, error)
}

type ListClusterRequest

type ListClusterRequest = connect.Request[v1alpha.ListClusterRequest]

workaround for generating gomock with generics failed parsing arguments: don't know how to parse type *ast.IndexExpr

type ListClusterResponse

type ListClusterResponse = connect.Response[v1alpha.ListClusterResponse]

workaround for generating gomock with generics failed parsing arguments: don't know how to parse type *ast.IndexExpr

type UpdateClusterRequest

type UpdateClusterRequest = connect.Request[v1alpha.UpdateClusterRequest]

workaround for generating gomock with generics failed parsing arguments: don't know how to parse type *ast.IndexExpr

Directories

Path Synopsis
Package mockhelper is a generated GoMock package.
Package mockhelper is a generated GoMock package.

Jump to

Keyboard shortcuts

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