Documentation
¶
Index ¶
- func GenerateCounter() int
- func GenerateNowDateTime() string
- func GenerateRandomCBOR() ([]byte, error)
- func GenerateRandomDateTime() string
- func GenerateRandomJSON() ([]byte, error)
- func GenerateSentence() string
- func GenerateSentimentPhrase() string
- func Interpolate(str string) ([]byte, error)
- func InterpolateWithDelimiters(str string, openDelim string, closeDelim string) ([]byte, error)
- type Payload
- type TestPayloadType
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GenerateCounter ¶
func GenerateCounter() int
func GenerateNowDateTime ¶
func GenerateNowDateTime() string
func GenerateRandomCBOR ¶
GenerateRandomCBOR creates a CBOR with predictable structure and random values
func GenerateRandomDateTime ¶
func GenerateRandomDateTime() string
func GenerateRandomJSON ¶
GenerateRandomJSON creates a JSON with predictable structure and random values
func GenerateSentence ¶
func GenerateSentence() string
GenerateSentence generates a random sentence for tests
func GenerateSentimentPhrase ¶
func GenerateSentimentPhrase() string
func Interpolate ¶
func InterpolateWithDelimiters ¶
InterpolateWithDelimiters performs template variable interpolation with custom delimiters Supports placeholders: json, cbor, sentiment, sentence, datetime, nowtime, counter, file:/path
Types ¶
type Payload ¶
type Payload struct {
ID string `faker:"uuid_hyphenated" json:"id"`
Name string `faker:"name" json:"name"`
Value float64 `faker:"lat" json:"value"` // use lat as random float
Active bool `json:"active"`
Time int64 `faker:"unix_time" json:"time"`
}
Payload represents the predictable payload structure faker annotates fields for automatic generation https://github.com/go-faker/faker#supported-tags
type TestPayloadType ¶
type TestPayloadType string
const ( TestPayloadJSON TestPayloadType = "json" TestPayloadCBOR TestPayloadType = "cbor" TestPayloadSentiment TestPayloadType = "sentiment" TestPayloadSentence TestPayloadType = "sentence" TestPayloadDateTime TestPayloadType = "datetime" // to generate a timestamp TestPayloadNowTime TestPayloadType = "nowtime" // to generate the current timestamp TestPayloadCounter TestPayloadType = "counter" // to generate an incrementing counter (not implemented yet )
func (TestPayloadType) Generate ¶
func (t TestPayloadType) Generate() ([]byte, error)
func (TestPayloadType) GetContentType ¶
func (t TestPayloadType) GetContentType() string
func (TestPayloadType) IsValid ¶
func (t TestPayloadType) IsValid() bool
Click to show internal directories.
Click to hide internal directories.