mongo

package
v0.0.0-...-50debf6 Latest Latest
Warning

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

Go to latest
Published: Jan 29, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type IMongoStore

type IMongoStore[T any] interface {
	FindOneBy(ctx context.Context, filter interface{}) (*T, error)
	FindBy(ctx context.Context, filter interface{}) (*[]T, error)
	Get(ctx context.Context) (*[]T, error)
	Delete(ctx context.Context, filter interface{}) error
	Create(ctx context.Context, obj T) error
}

func New

func New[T any](config MongoDbConfig, collection string) (IMongoStore[T], error)

type MongoDbConfig

type MongoDbConfig struct {
	Host     string
	Port     int
	User     string
	Password string
	Name     string
}

type MongoStore

type MongoStore[T any] struct {
	// contains filtered or unexported fields
}

func (MongoStore[T]) Create

func (s MongoStore[T]) Create(ctx context.Context, obj T) error

func (MongoStore[T]) Delete

func (s MongoStore[T]) Delete(ctx context.Context, filter interface{}) error

func (MongoStore[T]) FindBy

func (s MongoStore[T]) FindBy(ctx context.Context, filter interface{}) (*[]T, error)

func (MongoStore[T]) FindOneBy

func (s MongoStore[T]) FindOneBy(ctx context.Context, filter interface{}) (*T, error)

func (MongoStore[T]) Get

func (s MongoStore[T]) Get(ctx context.Context) (*[]T, error)

type StoreFilter

type StoreFilter = bson.M

Jump to

Keyboard shortcuts

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