Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ProtoRand ¶
type ProtoRand[T proto.Message] struct { *protorand.ProtoRand // contains filtered or unexported fields }
func (*ProtoRand[T]) ExcludeMask ¶
func (p *ProtoRand[T]) ExcludeMask(mask *fieldmaskpb.FieldMask)
If non-nil, fields listed in the mask will be unset in generated messages. When generating a partial message, listed fields will not be included in the list of possible fields to select from, as if the fields did not exist in the message at all. Paths in the mask are relative to the root of the message and can include nested fields. If nested fields are listed, the mask only applies to "leaf" fields, and not to containing messages.
func (*ProtoRand[T]) GenPartial ¶
Generate a message with a specific ratio of set/unset fields.
If ratio is 0, the message will be empty. If it is 1, all fields will be set. Otherwise, a randomly chosen subset of fields will be set. The ratio of set fields to unset fields is given by min(1, round(ratio * size)) where size is the number of fields in the current message. This function applies recursively to all fields, using the original ratio.
This function reads the same amount of randomness from the underlying random number generator as a single call to Gen().