Documentation ¶
Overview ¶
Package producer contains definitions for parsed producers, which are the result of ParseExprAsProducer.
Index ¶
- type DeepParsedProducer
- func (dp DeepParsedProducer) GetDeep() *annotation.ProduceTrigger
- func (dp DeepParsedProducer) GetDeepSlice() []*annotation.ProduceTrigger
- func (dp DeepParsedProducer) GetFieldProducers() []*annotation.ProduceTrigger
- func (dp DeepParsedProducer) GetShallow() *annotation.ProduceTrigger
- func (dp DeepParsedProducer) IsDeep() bool
- type ParsedProducer
- type ShallowParsedProducer
- func (sp ShallowParsedProducer) GetDeep() *annotation.ProduceTrigger
- func (sp ShallowParsedProducer) GetDeepSlice() []*annotation.ProduceTrigger
- func (sp ShallowParsedProducer) GetFieldProducers() []*annotation.ProduceTrigger
- func (sp ShallowParsedProducer) GetShallow() *annotation.ProduceTrigger
- func (sp ShallowParsedProducer) IsDeep() bool
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DeepParsedProducer ¶
type DeepParsedProducer struct { ShallowProducer *annotation.ProduceTrigger DeepProducer *annotation.ProduceTrigger FieldProducers []*annotation.ProduceTrigger }
DeepParsedProducer is a ParsedProducer that contains information about deeply produced values. This information will only be read if the produced value turns out to be one of the following cases. 1) DeepProducer for map or slice 2) FieldProducers (struct or pointer to a struct): It holds the producers for each field of the struct. FieldProducers is either nil or it has fixed size equal to the number of fields in the struct. Since, we only add producers for the field that can have nil value (pointers, interfaces, slices, etc.), many of field producers will have nil value. NOTE: If the array for FieldProducers results in increased memory usage of Nilaway, we can replace it with more compact data structure in the future.
func (DeepParsedProducer) GetDeep ¶
func (dp DeepParsedProducer) GetDeep() *annotation.ProduceTrigger
GetDeep for a DeepParsedProducer returns the ProduceTrigger producing indices of the value
func (DeepParsedProducer) GetDeepSlice ¶
func (dp DeepParsedProducer) GetDeepSlice() []*annotation.ProduceTrigger
GetDeepSlice for a DeepParsedProducer returns a singular slice containing the deep ProduceTrigger
func (DeepParsedProducer) GetFieldProducers ¶
func (dp DeepParsedProducer) GetFieldProducers() []*annotation.ProduceTrigger
GetFieldProducers returns field producers
func (DeepParsedProducer) GetShallow ¶
func (dp DeepParsedProducer) GetShallow() *annotation.ProduceTrigger
GetShallow for a DeepParsedProducer returns the ProduceTrigger producing the value itself
func (DeepParsedProducer) IsDeep ¶
func (dp DeepParsedProducer) IsDeep() bool
IsDeep for a DeepParsedProducer returns true
type ParsedProducer ¶
type ParsedProducer interface { GetShallow() *annotation.ProduceTrigger GetDeep() *annotation.ProduceTrigger GetFieldProducers() []*annotation.ProduceTrigger IsDeep() bool // GetDeepSlice returns a 0 or 1 length slice; sometimes this is a more convenient representation GetDeepSlice() []*annotation.ProduceTrigger }
ParsedProducer is one of the output objects of ParseExprAsProducer - it represents a production of a value, interfaced to abstract away the potential to also include deep production of that value, i.e. production of indices of that value
type ShallowParsedProducer ¶
type ShallowParsedProducer struct {
Producer *annotation.ProduceTrigger
}
ShallowParsedProducer is a ParsedProducer that does not contain information about deeply produced values
func (ShallowParsedProducer) GetDeep ¶
func (sp ShallowParsedProducer) GetDeep() *annotation.ProduceTrigger
GetDeep for a ShallowParsedProducer returns nil nilable(result 0)
func (ShallowParsedProducer) GetDeepSlice ¶
func (sp ShallowParsedProducer) GetDeepSlice() []*annotation.ProduceTrigger
GetDeepSlice for a ShallowParsedProducer returns an empty slice nilable(result 0)
func (ShallowParsedProducer) GetFieldProducers ¶
func (sp ShallowParsedProducer) GetFieldProducers() []*annotation.ProduceTrigger
GetFieldProducers returns nil as field producers
func (ShallowParsedProducer) GetShallow ¶
func (sp ShallowParsedProducer) GetShallow() *annotation.ProduceTrigger
GetShallow for a ShallowParsedProducer contains the singular ProduceTrigger of this object
func (ShallowParsedProducer) IsDeep ¶
func (sp ShallowParsedProducer) IsDeep() bool
IsDeep for a ShallowParsedProducer returns false