package
0.6.0
Repository: https://github.com/softwok/mongo-util.git
Documentation: pkg.go.dev

# Functions

Coll returns the collection associated with a model.
CollectionByName returns a new collection using the current configuration values.
CollName returns a model's collection name.
Ctx function creates and returns a new context with a default timeout value.
DefaultConfigs returns the current configuration values, client and database.
No description provided by the author
Init initializes the client and database using the specified configuration values, or default.
NewClient returns a new mongodb client.
NewCollection returns a new collection with the supplied database.
NewCtx function creates and returns a new context with the specified timeout.
ResetDefaultConfig resets the configuration values, client and database.
UpsertTrueOption returns new instance of UpdateOptions with the upsert property set to true.

# Structs

Collection performs operations on models and the given Mongodb collection.
Config struct contains extra configuration properties for the mdu package.
DateFields struct contains the `created_at` and `updated_at` fields that autofill when inserting or updating a model.
DefaultModel struct contains a model's default fields.
DefaultTenantModel struct contains a model's default fields.
No description provided by the author
No description provided by the author

# Interfaces

CollectionGetter interface contains a method to return a model's custom collection.
CollectionNameGetter interface contains a method to return the collection name of a model.
CreatedHook is called after a model has been created.
CreatingHook is called before saving a new model to the database.
DeletedHook is called after a model is deleted.
DeletingHook is called before a model is deleted.
Model interface contains base methods that must be implemented by each model.
SavedHook is called after a model is saved to the database.
SavingHook is called before a model (new or existing) is saved to the database.
UpdatedHook is called after a model is updated.
UpdatingHook is called before updating a model.