Documentation ¶
Index ¶
- func ConnectionString() (string, error)
- type Service
- func (s *Service) Connect(ctx context.Context, databaseName string) error
- func (s *Service) DeleteOne(ctx context.Context, collection string, objectID primitive.ObjectID) error
- func (s *Service) Disconnect(ctx context.Context) error
- func (s *Service) Find(ctx context.Context, collection string, filter bson.M, vs any, ...) error
- func (s *Service) FindOne(ctx context.Context, collection string, filter bson.M, v any) error
- func (s *Service) FindOneByID(ctx context.Context, collection string, objectID primitive.ObjectID, v any) error
- func (s *Service) InsertOne(ctx context.Context, collection string, v any) error
- func (s *Service) UpdateOne(ctx context.Context, collection string, objectID primitive.ObjectID, v any) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ConnectionString ¶
ConnectionString creates the connection string with the full URI for a Mongos.db instance.
Types ¶
type Service ¶
Service provides the functionality to use
func NewService ¶
func NewService() *Service
NewService creates a new service providing a Mongos.db connection
func (*Service) DeleteOne ¶
func (s *Service) DeleteOne(ctx context.Context, collection string, objectID primitive.ObjectID) error
DeleteOne deletes a document in a collection.
func (*Service) Disconnect ¶
Disconnect removes a connection to a MongoDB instance
func (*Service) Find ¶
func (s *Service) Find(ctx context.Context, collection string, filter bson.M, vs any, ops *options.FindOptions) error
Find finds many documents in a collection.
func (*Service) FindOneByID ¶
func (s *Service) FindOneByID(ctx context.Context, collection string, objectID primitive.ObjectID, v any) error
FindOneByID finds a documents with a specific ID in a collection.
Click to show internal directories.
Click to hide internal directories.