Documentation ¶
Index ¶
- func FillWithRandom(t *testing.T, randStream *rand.Rand, msg proto.Message)
- func Visit(msgPath string, msg protoreflect.Message, setter func(v protoreflect.Value), ...)
- type ClearFields
- func (v *ClearFields) VisitList(path string, msg protoreflect.List, setter func(v protoreflect.Value))
- func (v *ClearFields) VisitMap(path string, msg protoreflect.Map, setter func(v protoreflect.Value))
- func (v *ClearFields) VisitMessage(path string, msg protoreflect.Message, setter func(v protoreflect.Value))
- func (v *ClearFields) VisitPrimitive(path string, val protoreflect.Value, setter func(v protoreflect.Value))
- type FillerConfig
- type OverrideFiller
- type ProtoVisitor
- type ProtoVisitorBase
- func (v *ProtoVisitorBase) VisitList(path string, msg protoreflect.List, setter func(v protoreflect.Value))
- func (v *ProtoVisitorBase) VisitMap(path string, msg protoreflect.Map, setter func(v protoreflect.Value))
- func (v *ProtoVisitorBase) VisitMessage(path string, msg protoreflect.Message, setter func(v protoreflect.Value))
- func (v *ProtoVisitorBase) VisitPrimitive(path string, val protoreflect.Value, setter func(v protoreflect.Value))
- type RandomFiller
- type ReplaceFields
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Visit ¶
func Visit(msgPath string, msg protoreflect.Message, setter func(v protoreflect.Value), visitor ProtoVisitor)
Types ¶
type ClearFields ¶
type ClearFields struct { ProtoVisitorBase Paths sets.Set[string] }
func (*ClearFields) VisitList ¶
func (v *ClearFields) VisitList(path string, msg protoreflect.List, setter func(v protoreflect.Value))
func (*ClearFields) VisitMap ¶
func (v *ClearFields) VisitMap(path string, msg protoreflect.Map, setter func(v protoreflect.Value))
func (*ClearFields) VisitMessage ¶
func (v *ClearFields) VisitMessage(path string, msg protoreflect.Message, setter func(v protoreflect.Value))
func (*ClearFields) VisitPrimitive ¶
func (v *ClearFields) VisitPrimitive(path string, val protoreflect.Value, setter func(v protoreflect.Value))
type FillerConfig ¶ added in v1.127.0
type FillerConfig struct { Stream *rand.Rand FieldOverrides map[string]OverrideFiller }
type OverrideFiller ¶ added in v1.127.0
type ProtoVisitor ¶
type ProtoVisitor interface { VisitPrimitive(path string, val protoreflect.Value, setter func(v protoreflect.Value)) VisitMessage(path string, msg protoreflect.Message, setter func(v protoreflect.Value)) VisitList(path string, msg protoreflect.List, setter func(v protoreflect.Value)) VisitMap(path string, msg protoreflect.Map, setter func(v protoreflect.Value)) }
type ProtoVisitorBase ¶
type ProtoVisitorBase struct { }
func (*ProtoVisitorBase) VisitList ¶
func (v *ProtoVisitorBase) VisitList(path string, msg protoreflect.List, setter func(v protoreflect.Value))
func (*ProtoVisitorBase) VisitMap ¶
func (v *ProtoVisitorBase) VisitMap(path string, msg protoreflect.Map, setter func(v protoreflect.Value))
func (*ProtoVisitorBase) VisitMessage ¶
func (v *ProtoVisitorBase) VisitMessage(path string, msg protoreflect.Message, setter func(v protoreflect.Value))
func (*ProtoVisitorBase) VisitPrimitive ¶
func (v *ProtoVisitorBase) VisitPrimitive(path string, val protoreflect.Value, setter func(v protoreflect.Value))
type RandomFiller ¶ added in v1.126.0
type RandomFiller struct {
// contains filtered or unexported fields
}
func NewRandomFiller ¶ added in v1.126.0
func NewRandomFiller(fc *FillerConfig) *RandomFiller
func (*RandomFiller) Fill ¶ added in v1.126.0
func (rf *RandomFiller) Fill(t *testing.T, obj interface{})
Fill populates the fields of a struct with random values. Enums are handled separately in the two maps passed to the RandomFiller.
type ReplaceFields ¶
type ReplaceFields struct { ProtoVisitorBase Func func(path string, val protoreflect.Value) (protoreflect.Value, bool) }
func (*ReplaceFields) VisitPrimitive ¶
func (v *ReplaceFields) VisitPrimitive(path string, val protoreflect.Value, setter func(v protoreflect.Value))
Click to show internal directories.
Click to hide internal directories.