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 ¶
- type FakeClient
- func (f *FakeClient) CreateScrap(_ context.Context, sb scrap.ScrapBody) (scrap.ScrapID, error)
- func (f *FakeClient) DeleteName(context.Context, scrap.Type, string) error
- func (f *FakeClient) DeleteScrap(_ context.Context, _ scrap.Type, hashOrName string) error
- func (f *FakeClient) Expand(context.Context, scrap.Type, string, scrap.Lang, io.Writer) error
- func (f *FakeClient) GetName(context.Context, scrap.Type, string) (scrap.Name, error)
- func (f *FakeClient) ListNames(_ context.Context, _ scrap.Type) ([]string, error)
- func (f *FakeClient) LoadScrap(_ context.Context, _ scrap.Type, hashOrName string) (scrap.ScrapBody, error)
- func (f *FakeClient) PutName(context.Context, scrap.Type, string, scrap.Name) error
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 (*FakeClient) DeleteName ¶
func (*FakeClient) DeleteScrap ¶
Click to show internal directories.
Click to hide internal directories.