utils

package
v0.0.0-...-23cc077 Latest Latest
Warning

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

Go to latest
Published: Jul 1, 2024 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AreSortedStringArraysEquals

func AreSortedStringArraysEquals(arr1, arr2 []string) bool

func GetClosesRange

func GetClosesRange(fromNumber, toNumber int64, excludeNumbers []int64) (hasResult bool, from, to int64)

GetClosesRange returns the closest range of numbers, that not in the-exclude list. The input number must be > 0.

func GetClosesRangeWithExtensible

func GetClosesRangeWithExtensible(
	fromNumber, toNumber int64, funcGetExcludeNumbers func(int64, int64) ([]int64, error),
	onFirstTryNoResultExtendUpTo int64,
	onFirstTryNoResultExtendSize int,
) (hasResult bool, from, to int64, err error)

GetClosesRangeWithExtensible returns the closest range of numbers, that not in the-exclude list. The input number must be > 0. When no result, it used the provided arguments to extend the range and retry.

func GetEpochWeek

func GetEpochWeek(optionalEpochUtcSeconds int64) int64

func GetPartitionedTableNameByChainId

func GetPartitionedTableNameByChainId(tableName, chainId string) string

GetPartitionedTableNameByChainId returns the partitioned table name of the given table for the corresponding chain id. NOTICE: the implementation have to be safe from SQL injection.

func GetPartitionedTableNameBySaltInt64AndChainId

func GetPartitionedTableNameBySaltInt64AndChainId(tableName string, salt int64, chainId string) string

GetPartitionedTableNameBySaltInt64AndChainId returns the partitioned table name of the given table for the corresponding chain id with salt int64. NOTICE: the implementation have to be safe from SQL injection.

func IsEvmAddress

func IsEvmAddress(addr string) bool

func IsUrl

func IsUrl(str string) bool

func IsValidCosmosTransactionHash

func IsValidCosmosTransactionHash(hash string) bool

func IsValidEvmTransactionHash

func IsValidEvmTransactionHash(hash string) bool

func MakePartitionIdFromKeys

func MakePartitionIdFromKeys(keys ...any) string

MakePartitionIdFromKeys builds a partition id from the given keys.

func MergeError

func MergeError(err error, errs ...error) error

func NormalizeAddress

func NormalizeAddress(addr string) string

func NormalizeChainId

func NormalizeChainId(chainId string) string

func ObserveLongOperation

func ObserveLongOperation(
	actionName string, action func() error,
	warningAfter time.Duration, logger logging.Logger,
) error

ObserveLongOperation is a utility function that observes a long operation and logs a warning if it takes too long. TODO: use ObserveLongOperation when creating table partitions

func UnsafeExtractBech32Hrp

func UnsafeExtractBech32Hrp(bech32Addr string) (hrp string, success bool)

Types

This section is empty.

Jump to

Keyboard shortcuts

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