generator

package
v0.1.5 Latest Latest
Warning

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

Go to latest
Published: Jul 16, 2021 License: Apache-2.0 Imports: 2 Imported by: 2

Documentation

Overview

Package generator provides an interface to generate values

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetPayload

func GetPayload(gen *Generator) []byte

GetPayload returns the payload in bytes array format

Types

type Generator

type Generator struct {
	// contains filtered or unexported fields
}

Generator holds the parameters required to generate Data and the paylod generated

func NewGenerator

func NewGenerator(opts ...GeneratorOption) (*Generator, error)

NewGenerator creates a new generator structure

type GeneratorOption

type GeneratorOption func(*Generator) error

GeneratorOption holds the function option for generator

func Generate

func Generate(t GeneratorType) GeneratorOption

Generate the payload depending on the type of generator

func WithOWeatherConfig

func WithOWeatherConfig(apikey string, city string) GeneratorOption

WithOWeatherConfig creates the structure with OW options

func WithRandomBase

func WithRandomBase(
	temperature_base float64,
	humidity_base float64,
	pressure_base float64,
	temperature_variation float64,
	humidity_variation float64,
	pressure_variation float64,
) GeneratorOption

WithRandomBase creates the structure for random values

type GeneratorType

type GeneratorType int

GeneratorType is an alias for the enumeration value of the generator

const (
	Random      GeneratorType = iota // Random generator type
	OpenWeather GeneratorType = iota // OpenWeather generator type
)

Directories

Path Synopsis
Package converter converts datatypes to array of bytes
Package converter converts datatypes to array of bytes
Package openweather provides interface to openweather Based on https://gist.github.com/aodin/9493190 https://medium.com/@xcoulon/nested-structs-in-golang-2c750403a007
Package openweather provides interface to openweather Based on https://gist.github.com/aodin/9493190 https://medium.com/@xcoulon/nested-structs-in-golang-2c750403a007
Package random provides functions to generate random values for metheorological data
Package random provides functions to generate random values for metheorological data

Jump to

Keyboard shortcuts

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