Skip to content

Commit

Permalink
feat(IMEX-9): introduce a typedef to be able to mock ImportMessages.
Browse files Browse the repository at this point in the history
  • Loading branch information
xmichelo committed May 30, 2024
1 parent a616326 commit 6fe543d
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion message_import.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@ const (
var ErrImportEncrypt = errors.New("failed to encrypt message")
var ErrImportSizeExceeded = errors.New("message exceeds maximum import size of 30MB")

func (c *Client) ImportMessages(ctx context.Context, addrKR *crypto.KeyRing, workers, buffer int, req ...ImportReq) (stream.Stream[ImportRes], error) {
type ImportResStream stream.Stream[ImportRes] // gomock does not support generics. In order to be able to mock ImportMessages, we introduce a typedef.

func (c *Client) ImportMessages(ctx context.Context, addrKR *crypto.KeyRing, workers, buffer int, req ...ImportReq) (ImportResStream, error) {
// Encrypt each message.
for idx := range req {
enc, err := EncryptRFC822(addrKR, req[idx].Message)
Expand Down

0 comments on commit 6fe543d

Please sign in to comment.