mockregistry

package
v0.5.4 Latest Latest
Warning

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

Go to latest
Published: Nov 26, 2026 License: Apache-2.0, BSD-3-Clause, MIT Imports: 2 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package mockregistry provides a mock implementation of the registry.Registry interface.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MockKey

type MockKey struct {
	KName      string
	KClassName string
	KSubkeys   []registry.Key
	KValues    []registry.Value
}

MockKey mocks a registry.Key.

func (*MockKey) ClassName

func (o *MockKey) ClassName() ([]byte, error)

ClassName returns the class name of the key.

func (*MockKey) Close added in v0.1.5

func (o *MockKey) Close() error

Close does nothing when mocking.

func (*MockKey) Name

func (o *MockKey) Name() string

Name returns the name of the key.

func (*MockKey) SubkeyNames added in v0.1.5

func (o *MockKey) SubkeyNames() ([]string, error)

SubkeyNames returns the names of the subkeys of the key.

func (*MockKey) Subkeys

func (o *MockKey) Subkeys() ([]registry.Key, error)

Subkeys returns the subkeys of the key.

func (*MockKey) Value added in v0.1.6

func (o *MockKey) Value(name string) (registry.Value, error)

Value returns the value with the given name.

func (*MockKey) ValueBytes added in v0.1.6

func (o *MockKey) ValueBytes(name string) ([]byte, error)

ValueBytes directly returns the content (as bytes) of the named value.

func (*MockKey) ValueString added in v0.1.6

func (o *MockKey) ValueString(name string) (string, error)

ValueString directly returns the content (as string) of the named value.

func (*MockKey) Values

func (o *MockKey) Values() ([]registry.Value, error)

Values returns the different values contained in the key.

type MockRegistry

type MockRegistry struct {
	Keys map[string]registry.Key
}

MockRegistry mocks registry access.

func (*MockRegistry) Close

func (o *MockRegistry) Close() error

Close does nothing when mocking.

func (*MockRegistry) OpenKey

func (o *MockRegistry) OpenKey(_ string, path string) (registry.Key, error)

OpenKey open the requested registry key. Note that for mock registry, the hive is not used.

type MockValue

type MockValue struct {
	VName       string
	VData       []byte
	VDataString string
}

MockValue mocks a registry.Value.

func (*MockValue) Data

func (o *MockValue) Data() ([]byte, error)

Data returns the data contained in the value.

func (*MockValue) DataString added in v0.1.6

func (o *MockValue) DataString() (string, error)

DataString returns the data contained in the value as a string.

func (*MockValue) Name

func (o *MockValue) Name() string

Name returns the name of the value.

type Opener added in v0.1.6

type Opener struct {
	Registry *MockRegistry
}

Opener is an opener for the mock registry.

func NewOpener added in v0.1.6

func NewOpener(registry *MockRegistry) *Opener

NewOpener creates a new Opener for the mock registry.

func (*Opener) Open added in v0.1.6

func (o *Opener) Open() (registry.Registry, error)

Open returns the mock registry.

Jump to

Keyboard shortcuts

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