Documentation ¶
Overview ¶
* Copyright (c) 2019 Uroš Hercog <uros@orcus.network> * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License.
Index ¶
Constants ¶
This section is empty.
Variables ¶
Functions ¶
This section is empty.
Types ¶
type Storer ¶
type Storer interface { // Find searches for items which match the provided query. If it does not find any items // it should not return an error, but rather an empty slice. It should not return the // deleted items. Find(ctx context.Context, namespace, key string, item interface{}) error // Upsert stores a new item in the storage backend. If an id for an item is already set, // the function replaces the item. // The inserting of the list of items should happen atomically. Upsert(ctx context.Context, namespace, key string, item interface{}) error // Remove should remove the item from the store. This can be implemented // with a flag or actually removing the item. // If an item with the given id does not exist, it should return an error. Remove(ctx context.Context, namespace, key string) error // name returns the identifier of the storer Name() string }
Storer interface provides a way to easily implement any backend storage. It's heavily inspired by the rest-layer framework's storer implementation (https://github.com/rs/rest-layer).