mockdb

package
v0.11.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 5, 2016 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Overview

Package mock provides a mock storage Shipper interface for tests.

Index

Constants

This section is empty.

Variables

View Source
var MockCfg = map[string]map[string]config.Item{
	"mockcfg": {
		"/": config.Item{
			Key:                    "/",
			Value:                  []byte("Mock configuration"),
			CfgVersion:             int64(4),
			CfgModifiedNanoseconds: int64(1464675792991825937),
		},
		"initial": config.Item{
			Key:     "initial",
			Value:   []byte("initial value for test"),
			Version: int64(1),
		},
		"initial_second": config.Item{
			Key:     "initial_second",
			Value:   []byte("a second initial value for test"),
			Version: int64(3),
		},
		"json_value": config.Item{
			Key:     "initial_second",
			Value:   []byte(`{"json": "string", "num": 4}`),
			Version: int64(3),
		},
		"encoded": config.Item{
			Key:     "encoded",
			Value:   []byte(`eyJ1cGRhdGVkIjogImZyaWRheSJ9`),
			Version: int64(1),
		},
	},
}

MockCfg is just a map of mock records within a mock config.

Functions

This section is empty.

Types

type MockShipper

type MockShipper struct {
}

MockShipper struct implements the Shipper interface for testing purposes.

func (MockShipper) ConfigState

func (m MockShipper) ConfigState(opts config.Options) (string, error)

ConfigState returns the state of the config

func (MockShipper) CreateConfig

func (m MockShipper) CreateConfig(opts config.Options, settings map[string]interface{}) (interface{}, error)

CreateConfig creates a config

func (MockShipper) Delete

func (m MockShipper) Delete(opts config.Options) (config.Item, error)

Delete a Item (record)

func (MockShipper) DeleteConfig

func (m MockShipper) DeleteConfig(opts config.Options) (interface{}, error)

DeleteConfig deletes a config

func (MockShipper) Get

func (m MockShipper) Get(opts config.Options) (config.Item, error)

Get a Item (record)

func (MockShipper) Name

func (m MockShipper) Name(opts config.Options) string

Name returns the name for the interface

func (MockShipper) Options

func (m MockShipper) Options(opts config.Options) map[string]interface{}

Options returns various settings and options for the shipper

func (MockShipper) Update

func (m MockShipper) Update(opts config.Options) (config.Item, error)

Update a Item (record)

func (MockShipper) UpdateConfig

func (m MockShipper) UpdateConfig(opts config.Options, settings map[string]interface{}) (interface{}, error)

UpdateConfig updates a config

func (MockShipper) UpdateConfigVersion

func (m MockShipper) UpdateConfigVersion(opts config.Options) error

UpdateConfigVersion updates the incremental counter/state of a configuration and should be called on each change

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL