ext

package
v0.22.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MinInt

func MinInt(a, b int) int

func SliceContainsString

func SliceContainsString(slice []string, value string) bool

SliceContainsString returns true if the specified slice of strings contains the give value, false otherwise.

Types

type Clock

type Clock interface {
	Now() time.Time
}

Clock wraps the Now method. Introduced to allow replacing the global state with fixed clocks to facilitate testing. Now returns the current time.

func NewFixedClock

func NewFixedClock(fixedTime time.Time) Clock

func NewSystemClock

func NewSystemClock() Clock

type IDGenerator

type IDGenerator interface {
	// GenerateID generates a new identifier.
	GenerateID() string
}

IDGenerator defines contract for generating universally unique identifiers.

func NewGoogleUUIDGenerator

func NewGoogleUUIDGenerator() IDGenerator

NewGoogleUUIDGenerator constructs a new IDGenerator implemented with Google's UUID module.

func NewSimpleIDGenerator

func NewSimpleIDGenerator() IDGenerator

NewSimpleIDGenerator constructs a simple IDGenerator that starts at 1, increments up to 999999999999, and then rolls over.

Jump to

Keyboard shortcuts

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