utils

package module
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Mar 29, 2025 License: GPL-3.0 Imports: 2 Imported by: 0

README ΒΆ

Go-Utils πŸ› οΈ

Platform golang utils.

Documentation ΒΆ

Index ΒΆ

Constants ΒΆ

View Source
const Uint64Size = 8

Variables ΒΆ

This section is empty.

Functions ΒΆ

func CloneByteSlice ΒΆ

func CloneByteSlice(bytes []byte) []byte

CloneByteSlice clones a slice of bytes, as slices.Clone would do, but does not allocate extra space.

func ConcatByteSlices ΒΆ

func ConcatByteSlices(slices ...[]byte) []byte

ConcatByteSlice concatenates a byte slices, as slices.Concat would do, but does not allocate extra space.

func IsNil ΒΆ

func IsNil(value any) bool

IsNil checks if interface or its value is nil.

func UpdateWithTx ΒΆ

func UpdateWithTx[T any](target *T, dirty T, tx TxFunc[T]) error

UpdateWithTx passes the dirty value to the transaction function and, if the transaction occurred without errors, replaces the target with the dirty version. This is useful for use in public methods to avoid corrupting the state with errors.

Types ΒΆ

type TxFunc ΒΆ

type TxFunc[T any] func(dirty *T) error

Jump to

Keyboard shortcuts

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