helper

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Jul 27, 2023 License: MPL-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const DEV = "DEV"

Variables

This section is empty.

Functions

func BoolPointer added in v1.1.4

func BoolPointer(b bool) *bool

func GetContextWithCaller added in v1.1.7

func GetContextWithCaller(ctx context.Context, caller Caller) context.Context

func GetFirstElementOf

func GetFirstElementOf(parent string, children ...string) (key string)

func IsCreateState added in v1.1.7

func IsCreateState(ctx context.Context) bool

func IsDataRead added in v1.1.7

func IsDataRead(ctx context.Context) bool

func IsRefreshState added in v1.1.7

func IsRefreshState(ctx context.Context) bool

func IsUpdateState added in v1.1.7

func IsUpdateState(ctx context.Context) bool

func PtrString added in v1.2.0

func PtrString[T ~string](val *T) string

func Retry

func Retry(f Retryable, interval time.Duration, attempts int) (int, error)

Retry is a wrapper to retry functions.

func RetryUntilTimeout

func RetryUntilTimeout(f Retryable, interval time.Duration, timeout time.Duration) (int, error)

Retry is a wrapper to retry functions.

func SetPrimitiveList added in v1.2.0

func SetPrimitiveList[T any](data any) []T

func SetPrimitiveValue

func SetPrimitiveValue(input, model interface{}, key string)

func StringPointer added in v1.1.8

func StringPointer(s string) *string

func UpdateDataSourceSchema added in v1.2.0

func UpdateDataSourceSchema(d *schema.Schema) *schema.Schema

Types

type Caller added in v1.1.7

type Caller string
const (
	DataRead     Caller = "DataRead"
	RefreshState Caller = "RefreshState"
	CreateState  Caller = "CreateState"
	UpdateState  Caller = "UpdateState"
)

type RequestURL

type RequestURL string

func ConstructRequestURL

func ConstructRequestURL(paths ...string) (url RequestURL)

ConstructRequestURL constructs a request URL based on paths.

func (RequestURL) AppendQueryParams

func (ru RequestURL) AppendQueryParams(queryParameters url.Values) (url RequestURL)

AppendQueryParams appends query parameters to a request URL.

func (RequestURL) String

func (ru RequestURL) String() (urlString string)

String converts a request URL to a string.

type Retryable

type Retryable func() (bool, error)

Retryable is a simple function which can be retried, returns (retry[yes/no], error).

Jump to

Keyboard shortcuts

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