utils

package
v0.1.18 Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2024 License: BSD-3-Clause Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HandleGraphqlErrors

func HandleGraphqlErrors(diagnostics *diag.Diagnostics, err error, format string, formatArgs ...any)

func P

func P[T any](x T) *T

func Retry added in v0.1.18

func Retry(ctx context.Context, totalTime time.Duration, period time.Duration, handler func() (temporaryErr error, finalErr error)) error

Retry runs the function repeatedly until it succeeds, it fails with `finalErr`, or until the specified total duration elapses. Between each run it sleeps for the `period` time. It returns the last error upon failure, and logs all errors as it runs at `DEBUG` level.

Types

type GraphqlTransport

type GraphqlTransport struct {
	Inner            http.RoundTripper
	Token            string
	EnableDebugTrace bool
}

func (*GraphqlTransport) RoundTrip

func (t *GraphqlTransport) RoundTrip(req *http.Request) (*http.Response, error)

type LoggingHttpTransport added in v0.1.13

type LoggingHttpTransport struct {
	Inner http.RoundTripper
}

func (*LoggingHttpTransport) RoundTrip added in v0.1.13

func (t *LoggingHttpTransport) RoundTrip(req *http.Request) (*http.Response, error)

Jump to

Keyboard shortcuts

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