tools

package
v4.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 1, 2023 License: MPL-2.0 Imports: 12 Imported by: 0

Documentation

Overview

Package tools is where some legacy provider functions were dropped

Index

Constants

View Source
const DateTimeFormat = "2006-01-02T15:04:05Z"

DateTimeFormat is the layout used across the provider.

Variables

View Source
var ErrDateFormat = errors.New("unable to parse date")

ErrDateFormat is returned when there is an error parsing a string date

Functions

func AddPrefix

func AddPrefix(str, pre string) string

AddPrefix will add prefix to given string.

func BoolPtr

func BoolPtr(b bool) *bool

BoolPtr returns a pointer to a bool passed as an argument

func ContainsString

func ContainsString(s []string, searchTerm string) bool

ContainsString determines if the searched string appears in the array

func ConvertToString

func ConvertToString(data interface{}) (res string)

ConvertToString will convert different types to strings.

func DiagWarningf

func DiagWarningf(format string, a ...interface{}) diag.Diagnostics

DiagWarningf creates a diag.Diagnostics with a single Warning level diag.Diagnostic entry

func DiagsWithErrors

func DiagsWithErrors(d diag.Diagnostics, errs ...error) diag.Diagnostics

DiagsWithErrors appends several errors to a diag.Diagnostics

func Float64Ptr

func Float64Ptr(f float64) *float64

Float64Ptr returns a pointer to a float64 passed as an argument

func GetFirstNotEmpty

func GetFirstNotEmpty(values ...string) string

GetFirstNotEmpty returns first not empty string

func GetIntID

func GetIntID(str, prefix string) (int, error)

GetIntID is used to get the id out from the string.

func GetMd5Sum

func GetMd5Sum(key interface{}) (string, error)

GetMd5Sum calculates md5Sum for any given interface{}. Passing a nil pointer to GetMd5Sum will panic, as they cannot be transmitted by gob.

func GetSHAString

func GetSHAString(rdata string) string

GetSHAString returns a sha1 from the string

func Int64Ptr

func Int64Ptr(i int64) *int64

Int64Ptr returns a pointer to an int64 passed as an argument

func IntPtr

func IntPtr(i int) *int

IntPtr returns a pointer to an integer passed as an argument

func ParseDate

func ParseDate(layout, value string) (time.Time, error)

ParseDate is used to parse the date with default layout as DateTimeFormat.

func StringPtr

func StringPtr(s string) *string

StringPtr returns a pointer to a string passed as an argument

Types

This section is empty.

Jump to

Keyboard shortcuts

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