Documentation
¶
Overview ¶
Copyright 2025 Deirror. All rights reserved. Use of this source code is governed by a MIT-style license that can be found in the LICENSE file.
Copyright 2025 Deirror. All rights reserved. Use of this source code is governed by a MIT-style license that can be found in the LICENSE file.
Copyright 2025 Deirror. All rights reserved. Use of this source code is governed by a MIT-style license that can be found in the LICENSE file.
Copyright 2025 Deirror. All rights reserved. Use of this source code is governed by a MIT-style license that can be found in the LICENSE file.
Index ¶
- type Config
- type FileStoreClient
- func (f *FileStoreClient) Count(ctx context.Context, coll string, filter any) (int64, error)
- func (f *FileStoreClient) Delete(ctx context.Context, coll string, filter any) (int64, error)
- func (f *FileStoreClient) Find(ctx context.Context, coll string, filter any, results any) error
- func (f *FileStoreClient) FindWithOpts(ctx context.Context, coll string, filter any, results any, opts *FindOptions) error
- func (f *FileStoreClient) Insert(ctx context.Context, coll string, docs ...any) (any, error)
- func (f *FileStoreClient) Update(ctx context.Context, coll string, filter any, update any) (int64, error)
- type FindOptions
- type MongoStoreClient
- func (m *MongoStoreClient) Count(ctx context.Context, coll string, filter interface{}) (int64, error)
- func (m *MongoStoreClient) Delete(ctx context.Context, coll string, filter interface{}) (int64, error)
- func (m *MongoStoreClient) Find(ctx context.Context, coll string, filter interface{}, results interface{}) error
- func (m *MongoStoreClient) FindWithOpts(ctx context.Context, coll string, filter interface{}, results interface{}, ...) error
- func (m *MongoStoreClient) Insert(ctx context.Context, coll string, docs ...interface{}) (interface{}, error)
- func (m *MongoStoreClient) Update(ctx context.Context, coll string, filter interface{}, update interface{}) (int64, error)
- type Storer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
StoreURL string // used such as a MongoDB connection string (example: mongodb+srv://.../dbName)
Database string // which database to connect to
}
Config holds configuration details for connecting to a document database.
func (*Config) WithDatabse ¶ added in v1.6.6
WithDatabse sets a new document databse and returns the updated Config.
func (*Config) WithStoreURL ¶
WithStoreURL sets a new document store URL and returns the updated Config.
type FileStoreClient ¶ added in v1.6.17
type FileStoreClient struct {
// contains filtered or unexported fields
}
func NewFileStoreClient ¶ added in v1.6.17
func NewFileStoreClient(cfg *Config) *FileStoreClient
func (*FileStoreClient) FindWithOpts ¶ added in v1.6.17
func (f *FileStoreClient) FindWithOpts( ctx context.Context, coll string, filter any, results any, opts *FindOptions, ) error
type FindOptions ¶ added in v1.6.17
type MongoStoreClient ¶ added in v1.6.6
type MongoStoreClient struct {
// contains filtered or unexported fields
}
func NewMongoStoreClient ¶ added in v1.6.6
func NewMongoStoreClient(cfg *Config) (*MongoStoreClient, error)
func (*MongoStoreClient) Find ¶ added in v1.6.6
func (m *MongoStoreClient) Find(ctx context.Context, coll string, filter interface{}, results interface{}) error
func (*MongoStoreClient) FindWithOpts ¶ added in v1.6.17
func (m *MongoStoreClient) FindWithOpts( ctx context.Context, coll string, filter interface{}, results interface{}, o *FindOptions, ) error
type Storer ¶ added in v1.6.6
type Storer interface {
Insert(ctx context.Context, coll string, docs ...interface{}) (interface{}, error)
Update(ctx context.Context, coll string, filter interface{}, update interface{}) (int64, error)
Delete(ctx context.Context, coll string, filter interface{}) (int64, error)
Find(ctx context.Context, coll string, filter interface{}, results interface{}) error
FindWithOpts(ctx context.Context, coll string, filter interface{}, results interface{}, opts *FindOptions) error
Count(ctx context.Context, coll string, filter interface{}) (int64, error)
}