fake

package
v1.4.1 Latest Latest
Warning

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

Go to latest
Published: Aug 28, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package fake provides some helper functions to generate fake data for mocking / testing

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Choice

func Choice[T IChoice](choices []T) T

func Date

func Date(min time.Time, max time.Time) time.Time

Date creates a time.Time between min & max dates

func DateAsStr

func DateAsStr(min time.Time, max time.Time, f string) string

DateAsStr creates a random date between min & max values and retusn string version of it

func Float

func Float(min float64, max float64) float64

Float creates a float between the min & max

func FloatAsStr

func FloatAsStr(min float64, max float64) string

FloatAsStr generates a string version of a randomised float

func Int

func Int(min int, max int) int

Int generates an int64 whose value is beetween min and max

func IntAsStr

func IntAsStr(min int, max int) string

IntAsStr generates a random int (via Int) between min and & max and converts that to a string

func String

func String(length int) string

String generates a random string of `length“ from a fixed set of characters

Types

type IChoice

type IChoice interface {
	string | int | time.Time | float32 | float64 | bool | int64 | int32
}

Jump to

Keyboard shortcuts

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