# Functions
Coll return model's collection.
CollectionByName return new collection from default config.
CollectionByNameWithMode return new collection from default config.
CollName check if you provided collection name in your model, return it's name, otherwise guess model collection's name.
No description provided by the author
No description provided by the author
No description provided by the author
Ctx function create new context with default timeout and return it.
NewClient return new mongodb client.
NewCollection return new collection with passed database.
NewCtx function create and return new context with your specified timeout.
ResetDefaultConfig reset all of the default config.
Transaction creates a transaction with the default client.
TransactionWithClient creates a transaction with the given client.
TransactionWithCtx creates a transaction with the given context and the default client.
UpsertTrueOption returns new instance of the UpdateOptions with upsert=true property.
No description provided by the author
No description provided by the author
No description provided by the author
# Structs
Collection performs operations on models and given Mongodb collection.
Config struct contain extra config of mgm package.
DateFields struct contain `created_at` and `updated_at` fields that autofill on insert/update model.
No description provided by the author
No description provided by the author
DefaultModel struct contain model's default fields.
IDField struct contain model's ID field.
IDField struct contain model's ID field.
MongoConfig new version.
# Interfaces
CollectionGetter interface contain method to return model's custom collection.
CollectionNameGetter interface contain method to return collection name of model.
CreatedHook call after model has been created.
CreatingHook call before saving new model into database.
DeletedHook call after model has been deleted).
DeletingHook call before deleting model.
Model interface is base method that must implement by each model, If you're using `DefaultModel` struct in your model, don't need to implement any of those method.
SavedHook call after model has been saved in database.
SavingHook call before save model(new or existed model) into database.
UpdatedHook call after model updated.
UpdatingHook call when before updating model.
# Type aliases
TransactionFunc is a handler to manage a transaction.