mock

package
v0.194.0 Latest Latest
Warning

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

Go to latest
Published: Aug 22, 2024 License: BSD-3-Clause Imports: 7 Imported by: 0

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`.

Jump to

Keyboard shortcuts

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