fakeclient

package
v0.0.0-...-4448a72 Latest Latest
Warning

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

Go to latest
Published: Nov 11, 2024 License: BSD-3-Clause Imports: 7 Imported by: 0

Documentation

Overview

Package fakeclient offers a fake implementation of scrap.ScrapExchange. The scraps can be loaded into memory, but are not persisted anywhere. Such an implementation does not require internet access or authentication. For simplicity, it ignores the scrap.Type, as it assumes a given client will only care about one type of scrap anyway.

It is only meant to be used for local testing.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FakeClient

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

func New

func New(scraps map[string]scrap.ScrapBody) *FakeClient

New returns a fake (in-memory) client with the map of scraps preloaded.

func (*FakeClient) CreateScrap

func (f *FakeClient) CreateScrap(_ context.Context, sb scrap.ScrapBody) (scrap.ScrapID, error)

func (*FakeClient) DeleteName

func (f *FakeClient) DeleteName(context.Context, scrap.Type, string) error

func (*FakeClient) DeleteScrap

func (f *FakeClient) DeleteScrap(_ context.Context, _ scrap.Type, hashOrName string) error

func (*FakeClient) Expand

func (*FakeClient) GetName

func (*FakeClient) ListNames

func (f *FakeClient) ListNames(_ context.Context, _ scrap.Type) ([]string, error)

func (*FakeClient) LoadScrap

func (f *FakeClient) LoadScrap(_ context.Context, _ scrap.Type, hashOrName string) (scrap.ScrapBody, error)

func (*FakeClient) PutName

Jump to

Keyboard shortcuts

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