mirror of
https://github.com/opencloud-eu/opencloud.git
synced 2026-07-19 20:14:17 -04:00
* use gofakeit instead of loremipsum, as it can also fake images for attachments * random emails for testing: generate threads, add attachments
20 lines
660 B
Go
20 lines
660 B
Go
package gofakeit
|
|
|
|
import (
|
|
"reflect"
|
|
)
|
|
|
|
// Slice fills built-in types and exported fields of a struct with random data.
|
|
func Slice(v any) { sliceFunc(GlobalFaker, v) }
|
|
|
|
// Slice fills built-in types and exported fields of a struct with random data.
|
|
func (f *Faker) Slice(v any) { sliceFunc(f, v) }
|
|
|
|
func sliceFunc(f *Faker, v any) {
|
|
// Note: We intentionally call r with size -1 instead of using structFunc.
|
|
// structFunc starts with size 0, which would result in zero-length top-level
|
|
// slices and maps. Passing -1 lets rSlice/rMap auto-size (random length)
|
|
// when no fakesize tag is provided.
|
|
r(f, reflect.TypeOf(v), reflect.ValueOf(v), "", -1, 0)
|
|
}
|