utils

package
v1.11.0 Latest Latest
Warning

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

Go to latest
Published: Jun 27, 2025 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddFinalizer added in v1.11.0

func AddFinalizer(f func())

func CreateFile added in v1.9.0

func CreateFile(input string, closeOnExit bool, def ...io.Writer) (io.Writer, error)

func ExecuteFinalizers added in v1.11.0

func ExecuteFinalizers()

func FormatString added in v1.9.3

func FormatString[T constraints.Integer](dst []byte, integer T) string

func IgnoreError

func IgnoreError(fn func() error)

func IsUnderTest added in v1.9.0

func IsUnderTest() bool

func Must added in v1.10.0

func Must[T any](val T, err error) T

func RandDate

func RandDate(rnd *rand.Rand) time.Time

func RandDateStr added in v1.8.5

func RandDateStr(rnd *rand.Rand) string

RandDateStr generates time in string representation it is done in such way because we wanted to make JSON statement to work but scylla supports only string representation of date in JSON format

func RandIPV4Address added in v1.8.3

func RandIPV4Address(rnd *rand.Rand, v, pos int) string

func RandInt2 added in v1.8.3

func RandInt2(rnd *rand.Rand, minimum, maximum int) int

func RandString

func RandString(rnd *rand.Rand, ln int) string

func RandTime

func RandTime(rnd *rand.Rand) int64

According to the CQL binary protocol, time is an int64 in range [0;86399999999999] https://github.com/apache/cassandra/blob/f5df4b219e063cb24b9cc0c22b6e614506b8d903/doc/native_protocol_v4.spec#L941 An 8 byte two's complement long representing nanoseconds since midnight. Valid values are in the range 0 to 86399999999999

func RandTimestamp added in v1.8.5

func RandTimestamp(rnd *rand.Rand) int64

RandTimestamp generates timestamp in nanoseconds Date limit needed to make sure that textual representation of the date is parsable by cql and drivers Currently CQL fails: unable to parse date '95260-10-10T19:09:07.148+0000': marshaling error: Unable to parse timestamp from '95260-10-10t19:09:07.148+0000'" if year is bigger than 9999, same as golang time.Parse

func SingleScylla added in v1.11.0

func SingleScylla(tb testing.TB, _ ...time.Duration) *gocql.Session

func Sizeof added in v1.9.3

func Sizeof(v any) uint64

func TestContainers added in v1.10.0

func TestContainers(tb testing.TB, _ ...time.Duration) (*gocql.Session, *gocql.Session)

func UUIDFromTime

func UUIDFromTime(rnd *rand.Rand) string

func UnsafeBytes added in v1.11.0

func UnsafeBytes(s string) []byte

#nosec G103

func UnsafeString added in v1.11.0

func UnsafeString(b []byte) string

#nosec G103

Types

type MemoryFootprint added in v1.9.3

type MemoryFootprint interface {
	MemoryFootprint() uint64
}

type QueryContextKey added in v1.11.0

type QueryContextKey string
const (
	QueryID       QueryContextKey = "query_id"
	GeminiAttempt QueryContextKey = "gemini_attempt"
)

Jump to

Keyboard shortcuts

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