values

package
v0.0.5-alpha Latest Latest
Warning

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

Go to latest
Published: Apr 13, 2022 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package values provides an interface for generating values nolint: gosec

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FloatVal

func FloatVal() string

FloatVal create random float value and converts it to string

func IntVal

func IntVal() string

IntVal create random int value and converts it to string

func UIntVal

func UIntVal() string

UIntVal create random uint value and converts it to string

Types

type Gen

type Gen struct{}

Gen IGen implementation

func (*Gen) ArrayLen

func (g *Gen) ArrayLen(maxLen int) int

ArrayLen creates the length of an array

func (*Gen) Bool

func (g *Gen) Bool() string

Bool Generates an bool value

func (*Gen) Byte

func (g *Gen) Byte() string

Byte Generates an byte value

func (*Gen) Complex128

func (g *Gen) Complex128() string

Complex128 Generates an complex128 value

func (*Gen) Complex64

func (g *Gen) Complex64() string

Complex64 Generates an complex64 value

func (*Gen) DecoratorIndex

func (g *Gen) DecoratorIndex(length int) int

DecoratorIndex returns random index for array length of decorators

func (*Gen) DecoratorVal

func (g *Gen) DecoratorVal() bool

DecoratorVal Indicates if a value should be used in the decorator spec

func (*Gen) Error

func (g *Gen) Error() bool

Error Indicates if an error should be returned or nil

func (*Gen) Float32

func (g *Gen) Float32() string

Float32 Generates an float32 value

func (*Gen) Float64

func (g *Gen) Float64() string

Float64 Generates an float64 value

func (*Gen) Int

func (g *Gen) Int() string

Int Generates an int value

func (*Gen) Int16

func (g *Gen) Int16() string

Int16 Generates an int16 value

func (*Gen) Int32

func (g *Gen) Int32() string

Int32 Generates an int32 value

func (*Gen) Int64

func (g *Gen) Int64() string

Int64 Generates an int64 value

func (*Gen) Int8

func (g *Gen) Int8() string

Int8 Generates an int8 value

func (*Gen) MapLen

func (g *Gen) MapLen() int

MapLen creates the length of a map

func (*Gen) Rune

func (g *Gen) Rune() string

Rune Generates an rune value

func (*Gen) String

func (g *Gen) String() string

String Generates an bool value

func (*Gen) Type

func (g *Gen) Type() string

Type retrieves random basic lit type

func (*Gen) UInt

func (g *Gen) UInt() string

UInt Generates an uint value

func (*Gen) UInt16

func (g *Gen) UInt16() string

UInt16 Generates an uint16 value

func (*Gen) UInt32

func (g *Gen) UInt32() string

UInt32 Generates an uint32 value

func (*Gen) UInt64

func (g *Gen) UInt64() string

UInt64 Generates an uint64 value

func (*Gen) UInt8

func (g *Gen) UInt8() string

UInt8 Generates an uint8 value

func (*Gen) UIntPtr

func (g *Gen) UIntPtr() string

UIntPtr Generates an uintptr value

type GenMock

type GenMock struct {
	mock.Mock
}

GenMock mocks the basic lit generator

func (*GenMock) ArrayLen

func (g *GenMock) ArrayLen(maxLen int) int

ArrayLen returns length of arrays

func (*GenMock) Bool

func (g *GenMock) Bool() string

Bool returns bool value

func (*GenMock) Byte

func (g *GenMock) Byte() string

Byte returns byte value

func (*GenMock) Complex128

func (g *GenMock) Complex128() string

Complex128 returns complex128 value

func (*GenMock) Complex64

func (g *GenMock) Complex64() string

Complex64 returns complex64 value

func (*GenMock) DecoratorIndex

func (g *GenMock) DecoratorIndex(length int) int

DecoratorIndex returns decorator index for given length

func (*GenMock) DecoratorVal

func (g *GenMock) DecoratorVal() bool

DecoratorVal returns if decorator value

func (*GenMock) Error

func (g *GenMock) Error() bool

Error returns if error value

func (*GenMock) Float32

func (g *GenMock) Float32() string

Float32 returns float32 value

func (*GenMock) Float64

func (g *GenMock) Float64() string

Float64 returns float64 value

func (*GenMock) Int

func (g *GenMock) Int() string

Int returns int value

func (*GenMock) Int16

func (g *GenMock) Int16() string

Int16 returns int16 value

func (*GenMock) Int32

func (g *GenMock) Int32() string

Int32 returns int32 value

func (*GenMock) Int64

func (g *GenMock) Int64() string

Int64 returns int64 value

func (*GenMock) Int8

func (g *GenMock) Int8() string

Int8 returns int8 value

func (*GenMock) MapLen

func (g *GenMock) MapLen() int

MapLen returns length of a map

func (*GenMock) Rune

func (g *GenMock) Rune() string

Rune returns rune value

func (*GenMock) String

func (g *GenMock) String() string

String returns string value

func (*GenMock) Type

func (g *GenMock) Type() string

Type returns type value

func (*GenMock) UInt

func (g *GenMock) UInt() string

UInt returns uint value

func (*GenMock) UInt16

func (g *GenMock) UInt16() string

UInt16 returns uint16 value

func (*GenMock) UInt32

func (g *GenMock) UInt32() string

UInt32 returns uint32 value

func (*GenMock) UInt64

func (g *GenMock) UInt64() string

UInt64 returns uint64 value

func (*GenMock) UInt8

func (g *GenMock) UInt8() string

UInt8 returns uint8 value

func (*GenMock) UIntPtr

func (g *GenMock) UIntPtr() string

UIntPtr returns uintptr value

type IGen

type IGen interface {
	Bool() string
	String() string
	Type() string

	Int() string
	Int8() string
	Int16() string
	Int32() string
	Int64() string

	UInt() string
	UInt8() string
	UInt16() string
	UInt32() string
	UInt64() string
	UIntPtr() string

	Byte() string
	Rune() string

	Float32() string
	Float64() string

	Complex64() string
	Complex128() string

	Error() bool
	DecoratorVal() bool
	DecoratorIndex(length int) int

	ArrayLen(maxLen int) int
	MapLen() int
}

IGen the value generator interface

func NewGenerator

func NewGenerator() IGen

NewGenerator creates a new generator

Jump to

Keyboard shortcuts

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