Documentation ¶
Index ¶
- func NewCustomBsonRegistry() *bsoncodec.Registry
- type BaseMongoDocument
- type BaseMongoModel
- type Collection
- type Config
- type Database
- type Mongo
- func New(ctx context.Context, logger log.Log, opts ...*options.ClientOptions) (*Mongo, error)
- func NewWithAWSRoleAuth(ctx context.Context, serviceName string, logger log.Log, c Config, t Tracer, ...) (*Mongo, error)
- func NewWithDefaultOptions(ctx context.Context, serviceName string, logger log.Log, c Config, t Tracer, ...) (*Mongo, error)
- func (m *Mongo) Database(name string, opts ...*options.DatabaseOptions) *Database
- func (m *Mongo) GetClient() *mongo.Client
- func (m *Mongo) GetLogger() log.Log
- func (m *Mongo) HealthCheck(ctx context.Context) error
- func (m *Mongo) Name(ctx context.Context) string
- func (m *Mongo) Shutdown(ctx context.Context) error
- type MongoLogger
- type Tracer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewCustomBsonRegistry ¶
Types ¶
type BaseMongoDocument ¶
type BaseMongoDocument struct { CreatedAt *time.Time `json:"createdAt,omitempty" bson:"createdAt,omitempty"` UpdatedAt *time.Time `json:"updatedAt,omitempty" bson:"updatedAt,omitempty"` CreatedBy *string `json:"createdBy,omitempty" bson:"createdBy,omitempty"` UpdatedBy *string `json:"updatedBy,omitempty" bson:"updatedBy,omitempty"` }
func (*BaseMongoDocument) SetCreateParam ¶
func (b *BaseMongoDocument) SetCreateParam(actionBy string)
func (*BaseMongoDocument) SetUpdateParam ¶
func (b *BaseMongoDocument) SetUpdateParam(actionBy string)
type BaseMongoModel ¶
type BaseMongoModel struct { ID *primitive.ObjectID `json:"-" bson:"_id,omitempty"` *BaseMongoDocument `bson:",inline"` }
func (*BaseMongoModel) SetCreateParam ¶
func (b *BaseMongoModel) SetCreateParam(actionBy string)
func (*BaseMongoModel) SetUpdateParam ¶
func (b *BaseMongoModel) SetUpdateParam(actionBy string)
type Collection ¶
type Collection struct { *mongo.Collection // contains filtered or unexported fields }
type Database ¶
func (*Database) Collection ¶
func (d *Database) Collection(name string, opts ...*options.CollectionOptions) *Collection
type Mongo ¶
func NewWithAWSRoleAuth ¶
func NewWithDefaultOptions ¶ added in v5.1.3
type MongoLogger ¶
type MongoLogger struct {
// contains filtered or unexported fields
}
func (*MongoLogger) Error ¶
func (m *MongoLogger) Error(err error, message string, keysAndValues ...interface{})
func (*MongoLogger) Info ¶
func (m *MongoLogger) Info(level int, message string, keysAndValues ...interface{})
func (*MongoLogger) PoolEvent ¶
func (m *MongoLogger) PoolEvent(e *event.PoolEvent)
type Tracer ¶
type Tracer interface {
MongoDB() *event.CommandMonitor
}
Click to show internal directories.
Click to hide internal directories.