Documentation ¶
Overview ¶
package picker provided structures and method to manage injected variable system for Godog.
It allows an user to pick value into a store and inject them in steps through a variable replacement.
Index ¶
- func Debug()
- func NewReplacer(store *Store) func(step *messages.Pickle_PickleStep)
- func NoLog()
- func Reset()
- func ResetLog()
- type DataScope
- type InstanceItem
- type InstanceKind
- type InstanceStore
- type KeyValueStore
- type SeedManifest
- type Store
- func (store *Store) Del(key string, scope DataScope)
- func (store *Store) Get(key string) (value interface{}, exists bool)
- func (store *Store) GetInstance(key string) (kind InstanceKind, instance interface{}, exists bool)
- func (store *Store) Inject(inTo interface{}) interface{}
- func (store *Store) InjectAll(inTo string) string
- func (store *Store) Pick(key string, value interface{}, scope DataScope)
- func (store *Store) Reset()
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewReplacer ¶
func NewReplacer(store *Store) func(step *messages.Pickle_PickleStep)
NewReplacer provides function to replace picked variables in messages.Pickle_PickleStep Text and Arguments.
Types ¶
type DataScope ¶
type DataScope int
DataScope encourages to use provided constants for data scope storage.
const ( // PersistentValue allows to store data in persistent store. PersistentValue DataScope = iota + 1 // DisposableValue allows to store data in disposable store. DisposableValue // InstanceValue allows to store data in in instance store. // An instance is defined by a Key, a Kind and a Value (interface). // It can only store Kactus feature or internal instances. InstanceValue )
type InstanceItem ¶
type InstanceItem struct { Kind InstanceKind Instance interface{} }
InstanceItem describe a kactus tool instance.
type InstanceKind ¶
type InstanceKind int
InstanceKind encourages user to pass by instance constant when providing instance kind.
const ( // NoInstance is returned when // failed to retrieve instance from store. NoInstance InstanceKind = iota // Postgres kind refers to postgres.DB instance Postgres // GCP kind refers to pubsub.GCP instance GCP // REST refers to http.?? instance REST // Fixture refers to fixtures.Fixtures instance Fixture )
type InstanceStore ¶
type InstanceStore map[string]InstanceItem
InstanceStore represents the structure used by Store to manage kactus tools instances.
type KeyValueStore ¶
type KeyValueStore map[string]interface{}
KeyValueStore abstract management of values in store.
type SeedManifest ¶
type SeedManifest struct { Persistent map[string]interface{} `yaml:"persistent"` Disposable map[string]interface{} `yaml:"disposable"` }
SeedManifest represents the YAML structure to load data into store.
func (*SeedManifest) Load ¶
func (s *SeedManifest) Load(store *Store) error
Load parse SeedManifest and stores provided data.
type Store ¶
type Store struct { // Disposable stores picked data that will be forgotten on resets. Disposable KeyValueStore // Persistent stores picked data for all suite duration. Persistent KeyValueStore // Instance stores picked data as instance values. Instance InstanceStore }
Store picked data.
func (*Store) Get ¶
Get tries to retrieve stored values. If key is known in both Disposable and Persistent values, it will return the Disposable one.
func (*Store) GetInstance ¶
func (store *Store) GetInstance(key string) (kind InstanceKind, instance interface{}, exists bool)
GetInstance retrieves known kactus instance from picker.
func (*Store) Inject ¶
func (store *Store) Inject(inTo interface{}) interface{}
Inject returns value corresponding to element if element matches injectRegex. Else, returns provided value.
func (*Store) InjectAll ¶
InjectAll parses provided string using findAllInjectionRegex and replace injected values using Inject method.