diface

package
v1.0.4 Latest Latest
Warning

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

Go to latest
Published: Sep 7, 2024 License: MIT Imports: 2 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ICache

type ICache interface {
	// GetCache Get retrieves a Document from the cache.
	GetCache(key key.Key, doc any) bool
	// SetCache Set sets a Document in the cache.
	SetCache(key key.Key, doc any)
	// DeleteCache Delete deletes a Document from the cache.
	DeleteCache(key key.Key)
}

ICache provides a cache for Document objects.

func DefaultDocumentCache

func DefaultDocumentCache() ICache

DefaultDocumentCache returns a new ICache.

type ICollection

type ICollection interface {
	// GetName Name returns the name of this ICollection.
	GetName() string

	// Set creates or overwrites a nosql with the given keys and returns its version.  Use WithVersion to ensure this
	// function is updating the version of the nosql that you expect.  If you don't use WithVersion then this
	// function expects there to be no nosql.  If you want to set the nosql no matter what then use
	// WithAnyVersion.
	Set(key key.Key, opts ...noptions.Option) (noptions.Version, error)

	// Get loads an existing nosql from the nosql store and returns its cas.  If no such nosql exists then
	// this function fails.  Use WithTTL to update the nosql's expiration time.
	Get(key key.Key, opts ...noptions.Option) (noptions.Version, error)

	// Delete deletes a nosql from the nosql store.  If no such nosql exists then this function fails.
	Delete(key key.Key) error

	// Incr increments a nosql from the nosql store. (tips: can not be used for document,because the version)
	Incr(key key.Key, field string, amount int32) (int64, error)
}

ICollection is an abstract container of NoSQL documents located by keys.

type IDocumentProvider

type IDocumentProvider interface {
	OpenDbDriver(name string) (ICollection, error)
	Shutdown() error
}

IDocumentProvider knows how to open nosql stores by name.

Jump to

Keyboard shortcuts

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