Documentation ¶
Index ¶
- Constants
- func BuildCaches(caches map[string]CacheDefinition, existing map[string]Cache) map[string]Cache
- func InjectMaskContextFactories(factories []MaskContextFactory)
- func InjectMaskFactories(factories []MaskFactory)
- type Action
- type Applier
- type Cache
- type CacheDefinition
- type Collector
- type DateParserType
- type Definition
- type DeleteMaskEngineProcess
- type Dictionary
- type Entry
- type FF1Type
- type FromCacheProcess
- type FunctionMaskEngine
- type IncrementalType
- type MapProcess
- type Mapper
- type MaskCacheEngine
- type MaskContextEngine
- type MaskContextEngineProcess
- type MaskContextFactory
- type MaskEngine
- type MaskEngineProcess
- type MaskFactory
- type MaskType
- type Masking
- type MemCache
- type Observer
- type PipeType
- type Pipeline
- type ProcessPipeline
- func (p *ProcessPipeline) AddSink(sink SinkProcess) SinkedPipeline
- func (p *ProcessPipeline) Err() error
- func (p *ProcessPipeline) Next() bool
- func (p *ProcessPipeline) Process(process Processor) Pipeline
- func (p *ProcessPipeline) Value() Dictionary
- func (p *ProcessPipeline) WithSource(source Source) Pipeline
- type Processor
- func NewDeleteMaskEngineProcess(selector Selector) Processor
- func NewFromCacheProcess(selector Selector, cache Cache) Processor
- func NewMapProcess(mapper Mapper) Processor
- func NewMaskContextEngineProcess(selector Selector, mask MaskContextEngine) Processor
- func NewMaskEngineProcess(selector Selector, mask MaskEngine) Processor
- func NewRepeaterProcess(times int) Processor
- type QueueCollector
- type RandDateType
- type RandIntType
- type RandomDecimalType
- type RandomDurationType
- type RepeaterProcess
- type Selector
- type SelectorType
- type SimplePipeline
- func (pipeline SimplePipeline) AddSink(sink SinkProcess) SinkedPipeline
- func (pipeline SimplePipeline) Err() error
- func (pipeline SimplePipeline) Next() bool
- func (pipeline SimplePipeline) Open() error
- func (pipeline SimplePipeline) Process(process Processor) Pipeline
- func (pipeline SimplePipeline) Value() Dictionary
- func (pipeline SimplePipeline) WithSource(source Source) Pipeline
- type SimpleSinkedPipeline
- type SinkProcess
- type SinkToCache
- type SinkToSlice
- type SinkedPipeline
- type Source
- type SourceFromSlice
- type UniqueCache
- type UniqueMaskCacheEngine
- type UniqueMemCache
- type WeightedChoiceType
Constants ¶
View Source
const ( NOTHING Action = iota WRITE = iota DELETE = iota )
Variables ¶
This section is empty.
Functions ¶
func BuildCaches ¶
func InjectMaskContextFactories ¶
func InjectMaskContextFactories(factories []MaskContextFactory)
func InjectMaskFactories ¶
func InjectMaskFactories(factories []MaskFactory)
Types ¶
type Applier ¶
type Applier func(rootContext Dictionary, parentContext Dictionary, key string, value Entry) (Action, Entry)
type Cache ¶
type Cache interface { Get(key Entry) (Entry, bool) Put(key Entry, value Entry) Subscribe(key Entry, observer Observer) Iterate() Source }
func NewMemCache ¶
func NewMemCache() Cache
type CacheDefinition ¶
type CacheDefinition struct {
Unique bool `yaml:"unique"`
}
type Collector ¶
type Collector interface {
Collect(Dictionary)
}
Collector collect Dictionary generate by Process
type DateParserType ¶
type Definition ¶
type Definition struct { Version string `yaml:"version"` Seed int64 `yaml:"seed"` Masking []Masking `yaml:"masking"` Caches map[string]CacheDefinition `yaml:"caches"` }
func LoadPipelineDefinitionFromYAML ¶
func LoadPipelineDefinitionFromYAML(filename string) (Definition, error)
type DeleteMaskEngineProcess ¶
type DeleteMaskEngineProcess struct {
// contains filtered or unexported fields
}
func (*DeleteMaskEngineProcess) Open ¶
func (dp *DeleteMaskEngineProcess) Open() (err error)
func (*DeleteMaskEngineProcess) ProcessDictionary ¶
func (dp *DeleteMaskEngineProcess) ProcessDictionary(dictionary Dictionary, out Collector) error
type Dictionary ¶
func InterfaceToDictionary ¶
func InterfaceToDictionary(inter interface{}) Dictionary
InterfaceToDictionary returns a model.Dictionary from an interface
type FromCacheProcess ¶
type FromCacheProcess struct {
// contains filtered or unexported fields
}
func (*FromCacheProcess) Notify ¶
func (p *FromCacheProcess) Notify(key Entry, value Entry)
func (*FromCacheProcess) Open ¶
func (p *FromCacheProcess) Open() error
func (*FromCacheProcess) ProcessDictionary ¶
func (p *FromCacheProcess) ProcessDictionary(dictionary Dictionary, out Collector) error
type FunctionMaskEngine ¶
type FunctionMaskEngine struct {
Function func(Entry, ...Dictionary) (Entry, error)
}
FunctionMaskEngine implements MaskEngine with a simple function
func (FunctionMaskEngine) Mask ¶
func (fme FunctionMaskEngine) Mask(e Entry, context ...Dictionary) (Entry, error)
Mask delegate mask algorithm to the function
type IncrementalType ¶
type MapProcess ¶
type MapProcess struct {
// contains filtered or unexported fields
}
func (MapProcess) Open ¶
func (mp MapProcess) Open() error
func (MapProcess) ProcessDictionary ¶
func (mp MapProcess) ProcessDictionary(dictionary Dictionary, out Collector) error
type Mapper ¶
type Mapper func(Dictionary) (Dictionary, error)
type MaskCacheEngine ¶
type MaskCacheEngine struct { Cache Cache OriginalEngine MaskEngine }
MaskCacheEngine is a struct to create a cahed mask
func NewMaskCacheEngine ¶
func NewMaskCacheEngine(cache Cache, original MaskEngine) MaskCacheEngine
NewMaskCacheEngine create an MaskCacheEngine
func (MaskCacheEngine) Mask ¶
func (mce MaskCacheEngine) Mask(e Entry, context ...Dictionary) (Entry, error)
Mask masks run mask with cache
type MaskContextEngine ¶
type MaskContextEngine interface {
MaskContext(Dictionary, string, ...Dictionary) (Dictionary, error)
}
MaskContextEngine is a masking algorithm for dictionary
type MaskContextEngineProcess ¶
type MaskContextEngineProcess struct {
// contains filtered or unexported fields
}
func (*MaskContextEngineProcess) Open ¶
func (mcep *MaskContextEngineProcess) Open() error
func (*MaskContextEngineProcess) ProcessDictionary ¶
func (mcep *MaskContextEngineProcess) ProcessDictionary(dictionary Dictionary, out Collector) (ret error)
type MaskContextFactory ¶
type MaskEngine ¶
type MaskEngine interface {
Mask(Entry, ...Dictionary) (Entry, error)
}
MaskEngine is a masking algorithm
type MaskEngineProcess ¶
type MaskEngineProcess struct {
// contains filtered or unexported fields
}
func (*MaskEngineProcess) Open ¶
func (mep *MaskEngineProcess) Open() error
func (*MaskEngineProcess) ProcessDictionary ¶
func (mep *MaskEngineProcess) ProcessDictionary(dictionary Dictionary, out Collector) (ret error)
type MaskFactory ¶
type MaskType ¶
type MaskType struct { Add Entry `yaml:"add"` Constant Entry `yaml:"constant"` RandomChoice []Entry `yaml:"randomChoice"` RandomChoiceInURI string `yaml:"randomChoiceInUri"` Command string `yaml:"command"` RandomInt RandIntType `yaml:"randomInt"` WeightedChoice []WeightedChoiceType `yaml:"weightedChoice"` Regex string `yaml:"regex"` Hash []Entry `yaml:"hash"` HashInURI string `yaml:"hashInUri"` RandDate RandDateType `yaml:"randDate"` Incremental IncrementalType `yaml:"incremental"` Replacement string `yaml:"replacement"` Template string `yaml:"template"` Duration string `yaml:"duration"` Remove bool `yaml:"remove"` RangeMask int `yaml:"range"` RandomDuration RandomDurationType `yaml:"randomDuration"` FluxURI string `yaml:"fluxUri"` RandomDecimal RandomDecimalType `yaml:"randomDecimal"` DateParser DateParserType `yaml:"dateParser"` FromCache string `yaml:"fromCache"` FF1 FF1Type `yaml:"ff1"` Pipe PipeType `yaml:"pipe"` }
type Masking ¶
type Masking struct { Selector SelectorType `yaml:"selector"` Mask MaskType `yaml:"mask"` Cache string `yaml:"cache"` }
type MemCache ¶
type MemCache struct {
// contains filtered or unexported fields
}
MemCache is a cache in memory
type Pipeline ¶
type Pipeline interface { Process(Processor) Pipeline WithSource(Source) Pipeline AddSink(SinkProcess) SinkedPipeline }
func BuildPipeline ¶
func NewPipeline ¶
func NewPipelineFromSlice ¶
func NewPipelineFromSlice(dictionaries []Dictionary) Pipeline
func NewProcessPipeline ¶
type ProcessPipeline ¶
type ProcessPipeline struct { Processor // contains filtered or unexported fields }
func (*ProcessPipeline) AddSink ¶
func (p *ProcessPipeline) AddSink(sink SinkProcess) SinkedPipeline
func (*ProcessPipeline) Err ¶
func (p *ProcessPipeline) Err() error
func (*ProcessPipeline) Next ¶
func (p *ProcessPipeline) Next() bool
func (*ProcessPipeline) Process ¶
func (p *ProcessPipeline) Process(process Processor) Pipeline
func (*ProcessPipeline) Value ¶
func (p *ProcessPipeline) Value() Dictionary
func (*ProcessPipeline) WithSource ¶
func (p *ProcessPipeline) WithSource(source Source) Pipeline
type Processor ¶
type Processor interface { Open() error ProcessDictionary(Dictionary, Collector) error }
Processor process Dictionary and none, one or many element
func NewFromCacheProcess ¶
func NewMapProcess ¶
func NewMaskContextEngineProcess ¶
func NewMaskContextEngineProcess(selector Selector, mask MaskContextEngine) Processor
func NewMaskEngineProcess ¶
func NewMaskEngineProcess(selector Selector, mask MaskEngine) Processor
func NewRepeaterProcess ¶
type QueueCollector ¶
type QueueCollector struct {
// contains filtered or unexported fields
}
func NewCollector ¶
func NewCollector() *QueueCollector
func (*QueueCollector) Collect ¶
func (c *QueueCollector) Collect(dictionary Dictionary)
func (*QueueCollector) Err ¶
func (c *QueueCollector) Err() error
func (*QueueCollector) Next ¶
func (c *QueueCollector) Next() bool
func (*QueueCollector) Open ¶
func (c *QueueCollector) Open() error
func (*QueueCollector) Value ¶
func (c *QueueCollector) Value() Dictionary
type RandDateType ¶
type RandIntType ¶
type RandomDecimalType ¶
type RandomDurationType ¶
type RepeaterProcess ¶
type RepeaterProcess struct {
// contains filtered or unexported fields
}
func (RepeaterProcess) Open ¶
func (p RepeaterProcess) Open() error
func (RepeaterProcess) ProcessDictionary ¶
func (p RepeaterProcess) ProcessDictionary(dictionary Dictionary, out Collector) error
type Selector ¶
type Selector interface { Apply(Dictionary, ...Applier) bool ApplyContext(Dictionary, ...Applier) bool // old interface Delete(Dictionary) Dictionary ReadContext(Dictionary) (Dictionary, string, bool) WriteContext(Dictionary, Entry) Dictionary Read(Dictionary) (Entry, bool) Write(Dictionary, Entry) Dictionary }
func NewPathSelector ¶
type SelectorType ¶
type SelectorType struct {
Jsonpath string `yaml:"jsonpath"`
}
type SimplePipeline ¶
type SimplePipeline struct {
// contains filtered or unexported fields
}
func (SimplePipeline) AddSink ¶
func (pipeline SimplePipeline) AddSink(sink SinkProcess) SinkedPipeline
func (SimplePipeline) Err ¶
func (pipeline SimplePipeline) Err() error
func (SimplePipeline) Next ¶
func (pipeline SimplePipeline) Next() bool
func (SimplePipeline) Open ¶
func (pipeline SimplePipeline) Open() error
func (SimplePipeline) Process ¶
func (pipeline SimplePipeline) Process(process Processor) Pipeline
func (SimplePipeline) Value ¶
func (pipeline SimplePipeline) Value() Dictionary
func (SimplePipeline) WithSource ¶
func (pipeline SimplePipeline) WithSource(source Source) Pipeline
type SimpleSinkedPipeline ¶
type SimpleSinkedPipeline struct {
// contains filtered or unexported fields
}
func (SimpleSinkedPipeline) Run ¶
func (pipeline SimpleSinkedPipeline) Run() (err error)
type SinkProcess ¶
type SinkProcess interface { Open() error ProcessDictionary(Dictionary) error }
SinkProcess send Dictionary process by Pipeline to an output
func NewSinkToCache ¶
func NewSinkToCache(cache Cache) SinkProcess
func NewSinkToSlice ¶
func NewSinkToSlice(dictionaries *[]Dictionary) SinkProcess
type SinkToCache ¶
type SinkToCache struct {
// contains filtered or unexported fields
}
func (*SinkToCache) Open ¶
func (sink *SinkToCache) Open() error
func (*SinkToCache) ProcessDictionary ¶
func (sink *SinkToCache) ProcessDictionary(dictionary Dictionary) error
type SinkToSlice ¶
type SinkToSlice struct {
// contains filtered or unexported fields
}
func (*SinkToSlice) Open ¶
func (sink *SinkToSlice) Open() error
func (*SinkToSlice) ProcessDictionary ¶
func (sink *SinkToSlice) ProcessDictionary(dictionary Dictionary) error
type SinkedPipeline ¶
type SinkedPipeline interface {
Run() error
}
type Source ¶
type Source interface { Open() error Next() bool Value() Dictionary Err() error }
Source is an iterator over Dictionary
func NewSourceFromSlice ¶
func NewSourceFromSlice(dictionaries []Dictionary) Source
type SourceFromSlice ¶
type SourceFromSlice struct {
// contains filtered or unexported fields
}
func (*SourceFromSlice) Err ¶
func (source *SourceFromSlice) Err() error
func (*SourceFromSlice) Next ¶
func (source *SourceFromSlice) Next() bool
func (*SourceFromSlice) Open ¶
func (source *SourceFromSlice) Open() error
func (*SourceFromSlice) Value ¶
func (source *SourceFromSlice) Value() Dictionary
type UniqueCache ¶
func NewUniqueMemCache ¶
func NewUniqueMemCache() UniqueCache
type UniqueMaskCacheEngine ¶
type UniqueMaskCacheEngine struct {
// contains filtered or unexported fields
}
func NewUniqueMaskCacheEngine ¶
func NewUniqueMaskCacheEngine(cache UniqueCache, original MaskEngine) UniqueMaskCacheEngine
func (UniqueMaskCacheEngine) Mask ¶
func (umce UniqueMaskCacheEngine) Mask(e Entry, context ...Dictionary) (Entry, error)
Mask masks run mask with cache
type UniqueMemCache ¶
type UniqueMemCache struct { MemCache // contains filtered or unexported fields }
type WeightedChoiceType ¶
Click to show internal directories.
Click to hide internal directories.