Documentation ¶
Index ¶
- Constants
- Variables
- func New(locations []string) *fileParser
- func NewContext() *context
- func RegisterParser(format string, parser FixtureFileParser)
- type Database
- type Fixture
- type FixtureFileParser
- type HashRecordValue
- type HashValue
- type Hashes
- type KeyValue
- type Keys
- type ListRecordValue
- type ListValue
- type Lists
- type SetRecordValue
- type SetValue
- type Sets
- type Templates
- type Value
- type ZSetRecordValue
- type ZSetValue
- type ZSets
Constants ¶
const ( TypeInt = "int" TypeStr = "str" TypeFloat = "float" )
Variables ¶
Functions ¶
func NewContext ¶
func NewContext() *context
func RegisterParser ¶
func RegisterParser(format string, parser FixtureFileParser)
Types ¶
type Database ¶
type Database struct { Keys *Keys `yaml:"keys"` Hashes *Hashes `yaml:"hashes"` Sets *Sets `yaml:"sets"` Lists *Lists `yaml:"lists"` ZSets *ZSets `yaml:"zsets"` }
Database contains data to load into Redis database
type Fixture ¶
type Fixture struct { Inherits []string `yaml:"inherits"` Templates Templates `yaml:"templates"` Databases map[int]Database `yaml:"databases"` }
Fixture is a representation of the test data, that is preloaded to a redis database before the test starts
Example (yaml):
```yaml inherits:
- parent_template
- child_template
- other_fixture
databases:
1: keys: $name: keys1 values: a: value: 1 expiration: 10s b: value: 2 2: keys: $name: keys2 values: c: value: 3 expiration: 10s d: value: 4
```
type FixtureFileParser ¶
type FixtureFileParser interface { Parse(ctx *context, filename string) (*Fixture, error) Copy(parser *fileParser) FixtureFileParser }
func GetParser ¶
func GetParser(format string) FixtureFileParser
type HashRecordValue ¶
type HashRecordValue struct { Name string `yaml:"$name"` Extend string `yaml:"$extend"` Values []*HashValue `yaml:"values"` Expiration time.Duration `yaml:"expiration"` }
HashRecordValue represent a single hash data structure
type Hashes ¶
type Hashes struct {
Values map[string]*HashRecordValue `yaml:"values"`
}
Hashes represent a collection of hash data structures, that will be loaded into Redis database
type Keys ¶
type Keys struct { Name string `yaml:"$name"` Extend string `yaml:"$extend"` Values map[string]*KeyValue `yaml:"values"` }
Keys represent a collection of key/value pairs, that will be loaded into Redis database
type ListRecordValue ¶
type ListRecordValue struct { Name string `yaml:"$name"` Extend string `yaml:"$extend"` Values []*ListValue `yaml:"values"` Expiration time.Duration `yaml:"expiration"` }
ListRecordValue represent a single list data structure
type ListValue ¶
type ListValue struct {
Value Value `yaml:"value"`
}
ListValue represent a list value object
type Lists ¶
type Lists struct {
Values map[string]*ListRecordValue `yaml:"values"`
}
Lists represent a collection of Redis list data structures
type SetRecordValue ¶
type SetRecordValue struct { Name string `yaml:"$name"` Extend string `yaml:"$extend"` Values []*SetValue `yaml:"values"` Expiration time.Duration `yaml:"expiration"` }
SetRecordValue represent a single set data structure
type SetValue ¶
type SetValue struct {
Value Value `yaml:"value"`
}
SetValue represent a set value object
type Sets ¶
type Sets struct {
Values map[string]*SetRecordValue `yaml:"values"`
}
Sets represent a collection of set data structures, that will be loaded into Redis database
type Templates ¶
type Templates struct { Keys []*Keys `yaml:"keys"` Hashes []*HashRecordValue `yaml:"hashes"` Sets []*SetRecordValue `yaml:"sets"` Lists []*ListRecordValue `yaml:"lists"` ZSets []*ZSetRecordValue `yaml:"zsets"` }
type ZSetRecordValue ¶
type ZSetRecordValue struct { Name string `yaml:"$name"` Extend string `yaml:"$extend"` Values []*ZSetValue `yaml:"values"` Expiration time.Duration `yaml:"expiration"` }
ZSetRecordValue represent a single sorted set data structure
type ZSets ¶
type ZSets struct {
Values map[string]*ZSetRecordValue `yaml:"values"`
}
ZSets represent a collection of Redis sorted set data structure