util

package
v2.0.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Aug 28, 2019 License: BSD-3-Clause Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Range

type Range struct {
	// Low is inclusive
	Low int
	// High is exclusive
	High int
}

Range represents part of a slice High and low can be used with a golang slice [Low:High]

func Partition

func Partition(length int, size int) []Range

Partition calculates the indexes for splitting a slice of size length with a max partition size of size

type SafeBool

type SafeBool struct {
	sync.Mutex
	// contains filtered or unexported fields
}

SafeBool is a thread safe boolean

func (*SafeBool) Get

func (s *SafeBool) Get() bool

Get the value inside the SafeBool

func (*SafeBool) Set

func (s *SafeBool) Set(newVal bool)

Set the value inside the SafeBool

type SafeError

type SafeError struct {
	sync.Mutex
	// contains filtered or unexported fields
}

SafeError is a thread safe error

func (*SafeError) Get

func (s *SafeError) Get() error

Get the value inside the SafeError

func (*SafeError) Set

func (s *SafeError) Set(newVal error)

Set the value inside the SafeError

type SafeInt

type SafeInt struct {
	sync.Mutex
	// contains filtered or unexported fields
}

SafeInt is a thread safe int

func (*SafeInt) Add

func (s *SafeInt) Add(addend int) int

Add a value to the SafeInt

func (*SafeInt) Get

func (s *SafeInt) Get() int

Get the value inside SafeInt

func (*SafeInt) Set

func (s *SafeInt) Set(val int) int

Set the value of the SafeInt

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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