fakefill

package
v3.15.1 Latest Latest
Warning

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

Go to latest
Published: Jun 6, 2022 License: GPL-3.0 Imports: 4 Imported by: 0

Documentation

Overview

Package fakefill contains code to fill structs for testing.

This package is quite limited in scope and we can fill only the structures you typically send over as JSONs.

As part of future work, we aim to investigate whether we can replace this implementation with https://go.dev/blog/fuzz-beta.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Filler

type Filler struct {

	// Now is OPTIONAL and allows to mock the current time
	Now func() time.Time
	// contains filtered or unexported fields
}

Filler fills specific data structures with random data. The only exception to this behaviour is time.Time, which is instead filled with the current time plus a small random number of seconds.

We use this implementation to initialize data in our model. The code has been written with that in mind. It will require some hammering in case we extend the model with new field types.

Caveat: this kind of fillter does not support filling interfaces and channels and other complex types. The current behavior when this kind of data types is encountered is to just ignore them.

func (*Filler) Fill

func (ff *Filler) Fill(in interface{})

Fill fills the input structure or pointer with random data.

Jump to

Keyboard shortcuts

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