helper

package
v1.4.7 Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2024 License: MPL-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const DEV = "DEV"
View Source
const DoNotRetry = "do_not_retry"

Variables

This section is empty.

Functions

func BoolPointer added in v1.1.4

func BoolPointer(b bool) *bool

func ConvertToString added in v1.2.5

func ConvertToString(value interface{}, sliceSep string) string

func Float64Pointer added in v1.3.0

func Float64Pointer(f float64) *float64

func GetAllMapsKeys added in v1.4.0

func GetAllMapsKeys(maps ...map[string]interface{}) map[string]bool

func GetContextCaller added in v1.4.0

func GetContextCaller(ctx context.Context) any

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 IsContextCallerSet added in v1.3.1

func IsContextCallerSet(ctx context.Context) bool

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 IsDeleteState added in v1.3.1

func IsDeleteState(ctx context.Context) bool

func IsEmptyInterface added in v1.4.0

func IsEmptyInterface(value interface{}) 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, key string) []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"
	DeleteState  Caller = "DeleteState"
)

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

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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