Documentation ¶
Index ¶
- Variables
- func ConvertStringValueToInt64(jsonMap any, permitMissingPaths bool, paths ...string) (any, error)
- func MarshalProtoBSON(m proto.Message, update updateJSON) ([]byte, error)
- func UnmarshalProtoBSON(data []byte, m proto.Message, update updateJSON) error
- type Config
- type OnClearFn
- type Operator
- type Store
- func (s *Store) AddCloseFunc(f func())
- func (s *Store) Clear(ctx context.Context) error
- func (s *Store) Client() *mongo.Client
- func (s *Store) Close(ctx context.Context) error
- func (s *Store) Collection(collection string) *mongo.Collection
- func (s *Store) DBName() string
- func (s *Store) DropCollection(ctx context.Context, collection string) error
- func (s *Store) DropDatabase(ctx context.Context) error
- func (s *Store) EnsureIndex(ctx context.Context, collection string, indexes ...mongo.IndexModel) error
- func (s *Store) SetOnClear(onClear OnClearFn)
Constants ¶
This section is empty.
Variables ¶
var ErrPathNotFound = errors.New("path not found")
Functions ¶
func ConvertStringValueToInt64 ¶ added in v2.21.0
ConvertStringValueToInt64 converts string values to int64 in a JSON map based on provided paths. It iterates over the specified paths in the JSON map and converts the string values found at those paths to int64 values. If permitMissingPaths is set to true, missing paths in the JSON map will be ignored and the modified JSON map will be returned. If permitMissingPaths is set to false, an error will be returned if any of the specified paths are not found in the JSON map. The function returns the updated JSON map with the converted int64 values. If an error occurs during the conversion, the partially modified JSON map is returned along with the error.
func MarshalProtoBSON ¶ added in v2.21.0
Types ¶
type Config ¶
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store implements an Store for MongoDB.
func NewStore ¶
func NewStore(ctx context.Context, cfg *Config, tls *tls.Config, tracerProvider trace.TracerProvider) (*Store, error)
NewStore creates a new Store.
func NewStoreWithCollection ¶
func NewStoreWithCollections ¶ added in v2.19.1
func (*Store) AddCloseFunc ¶ added in v2.16.0
func (s *Store) AddCloseFunc(f func())
func (*Store) Collection ¶
func (s *Store) Collection(collection string) *mongo.Collection
Get collection with given name
func (*Store) DropCollection ¶
Drops selected collection from database
func (*Store) DropDatabase ¶
Drops the whole database
func (*Store) EnsureIndex ¶
func (*Store) SetOnClear ¶
Set the function called on Clear