Documentation

Overview

    Package mock demonstrates how to use interfaces to mock interactions with service in tests.

    Index

    Constants

    This section is empty.

    Variables

    This section is empty.

    Functions

    func TranslateTextHighLevel

    func TranslateTextHighLevel(service TranslateService, text, language string) (string, error)

      TranslateTextHighLevel translates text to the given language using the provided service.

      func TranslateTextLowLevel

      func TranslateTextLowLevel(call TranslateTextCall) (string, error)

        TranslateTextLowLevel executes the call and returns the translated text.

        Types

        type TranslateService

        type TranslateService interface {
        	TranslateText(text, language string) (string, error)
        }

          TranslateService is a facade of a `translate.Service`, specifically used to for translating text.

          func NewTranslateService

          func NewTranslateService(ctx context.Context, opts ...option.ClientOption) TranslateService

            NewTranslateService creates a TranslateService.

            type TranslateTextCall

            type TranslateTextCall interface {
            	Do(opts ...googleapi.CallOption) (*translate.TranslateTextResponse, error)
            }

              TranslateTextCall is used to translate text and is fullfilled by a `translate.ProjectsTranslateTextCall`.