mock

package
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: Dec 3, 2024 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	// Data stores a serialized data for history.
	Data string `hcl:"data"`
	// WriteError is a flag to return an error on Write().
	WriteError bool `hcl:"write_error"`
	// ReadError is a flag to return an error on Read().
	ReadError bool `hcl:"read_error"`
	// contains filtered or unexported fields
}

Config is a config for mock storage.

func (*Config) NewStorage

func (c *Config) NewStorage() (storage.Storage, error)

NewStorage returns a new instance of storage.Storage.

func (*Config) Storage

func (c *Config) Storage() *Storage

Storage returns a reference to mock storage for testing.

type Storage

type Storage struct {
	// contains filtered or unexported fields
}

Storage is a storage.Storage implementation for mock. It writes and reads data from memory.

func NewStorage

func NewStorage(config *Config) (*Storage, error)

NewStorage returns a new instance of Storage.

func (*Storage) Data

func (s *Storage) Data() string

Data returns a raw data in mock storage for testing.

func (*Storage) Read

func (s *Storage) Read(_ context.Context) ([]byte, error)

Read reads migration history data from storage.

func (*Storage) Write

func (s *Storage) Write(_ context.Context, b []byte) error

Write writes migration history data to storage.

Jump to

Keyboard shortcuts

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