generator

package
v0.0.0-...-59a2ff7 Latest Latest
Warning

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

Go to latest
Published: Nov 1, 2021 License: AGPL-3.0 Imports: 2 Imported by: 0

Documentation

Overview

Package generator provides pgtype specific value generators. Generation is driven by the pseudo-random number generator from `math/rand`. This allows for deterministic value generation, using a seed for each constructor. Note that this determinism is also affected by other parameters, such as a minimum or maximum value.

Each constructor also takes an argument for percentage of probability for a SQL null with each newly generated value. If the probability is 0 or lower, random null generation is disabled. Use this mode for columns with constraint NOT NULL. If the probability is 100 or higher, only nulls are generated.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Value

type Value interface {
	pgtype.ValueTranscoder
	// NextValue populates the Value with a newly generated value.
	NextValue()
}

Value generates a pgtype value on each read access.

func NewBool

func NewBool(seed int64, nullProbabilty, probabilty float32) Value

NewBool returns a boolean value generator.

Probability is a percentage of chance `true` values are generated on each read. If probability is 0 or lower, only `false` values are generated. If probability is 100 or highter, only `true` values are generated.

Jump to

Keyboard shortcuts

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