mock

package
v1.1.5 Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2023 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenObj

func GenObj[T any](opts ...utils.OptionExtender) (v T)

func GenObjBySerializeAlgo

func GenObjBySerializeAlgo(algo serialize.Algorithm) (data any)

func GenObjList

func GenObjList[T any](num int, opts ...utils.OptionExtender) (vList []T)

func GenObjListBySerializeAlgo

func GenObjListBySerializeAlgo(algo serialize.Algorithm, num int) (dataList any)

func IgnoreFields

func IgnoreFields(ignored ...string) utils.OptionFunc[randomOption]

Types

type AllType

type AllType struct {
	Str  string
	Strp *string

	StrSlice  []string
	StrpSlice []*string

	Rune  rune
	Runep *rune

	RuneSlice  []rune
	RunepSlice []*rune

	Byte  byte
	Bytep *byte

	ByteSlice  []byte
	BytepSlice []*byte

	Bool  bool
	Boolp *bool

	BoolSlice  []bool
	BoolpSlice []*bool

	Int   int
	Int8  int8
	Int16 int16
	Int32 int32
	Int64 int64

	IntSlice   []int
	Int8Slice  []int8
	Int16Slice []int16
	Int32Slice []int32
	Int64Slice []int64

	Intp   *int
	Int8p  *int8
	Int16p *int16
	Int32p *int32
	Int64p *int64

	IntpSlice   []*int
	Int8pSlice  []*int8
	Int16pSlice []*int16
	Int32pSlice []*int32
	Int64pSlice []*int64

	Uint   uint
	Uint8  uint8
	Uint16 uint16
	Uint32 uint32
	Uint64 uint64

	UintSlice   []uint
	Uint8Slice  []uint8
	Uint16Slice []uint16
	Uint32Slice []uint32
	Uint64Slice []uint64

	Uintp   *uint
	Uint8p  *uint8
	Uint16p *uint16
	Uint32p *uint32
	Uint64p *uint64

	UintpSlice   []*uint
	Uint8pSlice  []*uint8
	Uint16pSlice []*uint16
	Uint32pSlice []*uint32
	Uint64pSlice []*uint64

	Float32 float32
	Float64 float64

	Float32Slice []float32
	Float64Slice []float64

	Float32p *float32
	Float64p *float64

	Float32pSlice []*float32
	Float64pSlice []*float64

	Complex64  complex64  `faker:"-" json:"-"`
	Complex128 complex128 `faker:"-" json:"-"`

	Complex64Slice  []complex64  `faker:"-" json:"-"`
	Complex128Slice []complex128 `faker:"-" json:"-"`

	Complex64p  *complex64  `faker:"-" json:"-"`
	Complex128p *complex128 `faker:"-" json:"-"`

	Complex64pSlice  []*complex64  `faker:"-" json:"-"`
	Complex128pSlice []*complex128 `faker:"-" json:"-"`

	Uintptr  uintptr  `faker:"-"`
	Uintptrp *uintptr `faker:"-"`

	UintptrSlice  []uintptr  `faker:"-"`
	UintptrpSlice []*uintptr `faker:"-"`

	Any  any  `faker:"-"`
	Anyp *any `faker:"-"`

	AnySlice  []any  `faker:"-"`
	AnypSlice []*any `faker:"-"`

	Time  time.Time
	Timep *time.Time
}

type CommonObj

type CommonObj struct {
	CommonType

	Basic  CommonType
	Basicp *CommonType

	Int64Map  map[int64]*CommonType
	StringMap map[string]*CommonType

	Array [2]*CommonType

	Nil *CommonType
}

func (*CommonObj) EventType

func (r *CommonObj) EventType() string

type CommonType

type CommonType struct {
	Str  string
	Strp *string

	StrSlice  []string
	StrpSlice []*string

	Rune  rune
	Runep *rune

	RuneSlice  []rune
	RunepSlice []*rune

	Byte  byte
	Bytep *byte

	ByteSlice  []byte
	BytepSlice []*byte

	Bool  bool
	Boolp *bool

	BoolSlice  []bool
	BoolpSlice []*bool

	Int   int
	Int8  int8
	Int16 int16
	Int32 int32
	Int64 int64

	IntSlice   []int
	Int8Slice  []int8
	Int16Slice []int16
	Int32Slice []int32
	Int64Slice []int64

	Intp   *int
	Int8p  *int8
	Int16p *int16
	Int32p *int32
	Int64p *int64

	IntpSlice   []*int
	Int8pSlice  []*int8
	Int16pSlice []*int16
	Int32pSlice []*int32
	Int64pSlice []*int64

	Uint   uint
	Uint8  uint8
	Uint16 uint16
	Uint32 uint32
	Uint64 uint64

	UintSlice   []uint
	Uint8Slice  []uint8
	Uint16Slice []uint16
	Uint32Slice []uint32
	Uint64Slice []uint64

	Uintp   *uint
	Uint8p  *uint8
	Uint16p *uint16
	Uint32p *uint32
	Uint64p *uint64

	UintpSlice   []*uint
	Uint8pSlice  []*uint8
	Uint16pSlice []*uint16
	Uint32pSlice []*uint32
	Uint64pSlice []*uint64

	Float32 float32
	Float64 float64

	Float32Slice []float32
	Float64Slice []float64

	Float32p *float32
	Float64p *float64

	Float32pSlice []*float32
	Float64pSlice []*float64

	Any  any  `faker:"-"`
	Anyp *any `faker:"-"`

	AnySlice  []any  `faker:"-"`
	AnypSlice []*any `faker:"-"`
}

type RandomObj

type RandomObj struct {
	AllType

	Basic  AllType
	Basicp *AllType

	Int64Map   map[int64]*AllType
	Float64Map map[float64]*AllType
	StringMap  map[string]*AllType

	Array [2]*AllType

	Nil *AllType
}

func (*RandomObj) EventType

func (r *RandomObj) EventType() string

Jump to

Keyboard shortcuts

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