internal

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: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DatabaseDriver

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

DatabaseDriver is a driver for a MongoDB database.

func NewCollectionDriver

func NewCollectionDriver(database *mongo.Database) (*DatabaseDriver, error)

NewCollectionDriver creates a new DatabaseDriver.

func (*DatabaseDriver) Delete added in v0.0.2

func (dd *DatabaseDriver) Delete(key key.Key) error

Delete delete a document by a key

func (*DatabaseDriver) Get

func (dd *DatabaseDriver) Get(key key.Key, opts ...noptions.Option) (noptions.Version, error)

Get data from mongoDB

func (*DatabaseDriver) GetName

func (dd *DatabaseDriver) GetName() string

GetName Name returns the name of this ICollection.

func (*DatabaseDriver) Incr added in v0.0.2

func (dd *DatabaseDriver) Incr(key key.Key, field string, amount int32) (int64, error)

Incr increments a document from the nosql store. (tips: can not be used for document,because the version)

func (*DatabaseDriver) Set

func (dd *DatabaseDriver) Set(key key.Key, opts ...noptions.Option) (noptions.Version, error)

Set with a key and options If the version is not noVersion, then the version must match the version in the database, Or it will return error `ErrVersionNotMatch`

type DriverProvider

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

func NewDriverProvider

func NewDriverProvider(
	mClient *mongo.Client,
	logger *zap.Logger,
) *DriverProvider

NewDriverProvider returns a new DriverProvider.

func (*DriverProvider) OpenDbDriver

func (dp *DriverProvider) OpenDbDriver(name string) (diface.ICollection, error)

func (*DriverProvider) Shutdown

func (dp *DriverProvider) Shutdown() error

Jump to

Keyboard shortcuts

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