mongodb

package
v1.15.1 Latest Latest
Warning

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

Go to latest
Published: Jun 9, 2025 License: Apache-2.0 Imports: 25 Imported by: 0

Documentation

Overview

Package mongodb is an implementation of StateStore interface to perform operations on store

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewMongoDB

func NewMongoDB(logger logger.Logger) state.Store

NewMongoDB returns a new MongoDB state store.

Types

type Item

type Item struct {
	Key   string      `bson:"_id"`
	Value interface{} `bson:"value"`
	Etag  string      `bson:"_etag"`
	TTL   *time.Time  `bson:"_ttl,omitempty"`
}

Item is Mongodb document wrapper.

type MongoDB

type MongoDB struct {
	state.BulkStore
	// contains filtered or unexported fields
}

MongoDB is a state store implementation for MongoDB.

func (*MongoDB) BulkGet

func (*MongoDB) Close

func (m *MongoDB) Close() error

Close connection to the database.

func (*MongoDB) Delete

func (m *MongoDB) Delete(ctx context.Context, req *state.DeleteRequest) error

Delete performs a delete operation.

func (*MongoDB) Features

func (m *MongoDB) Features() []state.Feature

Features returns the features available in this state store.

func (*MongoDB) Get

func (m *MongoDB) Get(ctx context.Context, req *state.GetRequest) (*state.GetResponse, error)

Get retrieves state from MongoDB with a key.

func (*MongoDB) GetComponentMetadata

func (m *MongoDB) GetComponentMetadata() (metadataInfo metadata.MetadataMap)

func (*MongoDB) Init

func (m *MongoDB) Init(ctx context.Context, metadata state.Metadata) (err error)

Init establishes connection to the store based on the metadata.

func (*MongoDB) Multi

func (m *MongoDB) Multi(ctx context.Context, request *state.TransactionalStateRequest) error

Multi performs a transactional operation. succeeds only if all operations succeed, and fails if one or more operations fail.

func (*MongoDB) Ping

func (m *MongoDB) Ping(ctx context.Context) error

func (*MongoDB) Query

Query executes a query against store.

func (*MongoDB) Set

func (m *MongoDB) Set(ctx context.Context, req *state.SetRequest) error

Set saves state into MongoDB.

type Query

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

func (*Query) Finalize

func (q *Query) Finalize(filters string, qq *query.Query) error

func (*Query) VisitAND

func (q *Query) VisitAND(f *query.AND) (string, error)

func (*Query) VisitEQ

func (q *Query) VisitEQ(f *query.EQ) (string, error)

func (*Query) VisitGT

func (q *Query) VisitGT(f *query.GT) (string, error)

func (*Query) VisitGTE

func (q *Query) VisitGTE(f *query.GTE) (string, error)

func (*Query) VisitIN

func (q *Query) VisitIN(f *query.IN) (string, error)

func (*Query) VisitLT

func (q *Query) VisitLT(f *query.LT) (string, error)

func (*Query) VisitLTE

func (q *Query) VisitLTE(f *query.LTE) (string, error)

func (*Query) VisitNEQ

func (q *Query) VisitNEQ(f *query.NEQ) (string, error)

func (*Query) VisitOR

func (q *Query) VisitOR(f *query.OR) (string, error)

Jump to

Keyboard shortcuts

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