helpers

package
v3.30.0 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2024 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package helpers contains helpers to assist in other parts of the code

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CleanNetworkAddressFromError added in v3.22.0

func CleanNetworkAddressFromError(err error) error

CleanNetworkAddressFromError checks whether an IP:Port->IP:port information is contained in the error. This is checked by explicitly sanitizing *net.OpError instances or by returning a sanitized error string without the stack previously present.

As of the loss of information this is only intended to clean up logging and not be used in error returns.

func Ptr added in v3.29.0

func Ptr[T any](v T) *T

Ptr creates a pointer to any given type

func Retry added in v3.20.0

func Retry(fn func() error) error

Retry contains a standard set of configuration parameters for an exponential backoff to be used throughout the bot

func RetryTransaction added in v3.20.0

func RetryTransaction(db *gorm.DB, fn func(tx *gorm.DB) error) error

RetryTransaction takes a database object and a function acting on the database. The function will be run in a transaction on the database and will be retried as if executed using Retry

func SchemaValidateTemplateField added in v3.29.0

func SchemaValidateTemplateField(tplValidator func(string) error, fields ...string) fieldcollection.ValidateOpt

SchemaValidateTemplateField contains a ValidateOpt for the fieldcollection schema validator to validate template fields

Types

This section is empty.

Jump to

Keyboard shortcuts

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