Documentation
¶
Index ¶
- func ForContext(ctx context.Context) *mongo.Client
- type MongoDBHandler
- func (m *MongoDBHandler) Collection(ctx context.Context, col string) (*mongo.Collection, error)
- func (m *MongoDBHandler) Connect() gin.HandlerFunc
- func (m *MongoDBHandler) DeleteUser(ctx context.Context, id string) (string, error)
- func (dbHandler *MongoDBHandler) Disconnect(ctx context.Context) error
- func (m *MongoDBHandler) FindAllUsers(ctx context.Context) ([]*domain.User, error)
- func (m *MongoDBHandler) FindUserByID(ctx context.Context, id string) (*domain.User, error)
- func (m *MongoDBHandler) SaveUser(ctx context.Context, newUser domain.NewUser) (*domain.User, error)
- func (m *MongoDBHandler) WithContext(ctx context.Context) context.Context
- type MongoDbInitProvider
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type MongoDBHandler ¶
MongoDBHandler is connection provider to access to global mongodb client
func NewMongoDatabase ¶
func NewMongoDatabase(cnf config.Env, Logger *zap.Logger) (*mongo.Client, error) {
func (*MongoDBHandler) Collection ¶
func (m *MongoDBHandler) Collection(ctx context.Context, col string) (*mongo.Collection, error)
func (*MongoDBHandler) Connect ¶
func (m *MongoDBHandler) Connect() gin.HandlerFunc
Connect is method return adpater for http request that
func (*MongoDBHandler) DeleteUser ¶
func (*MongoDBHandler) Disconnect ¶
func (dbHandler *MongoDBHandler) Disconnect(ctx context.Context) error
Disconnect is method return adpater for http request that
func (*MongoDBHandler) FindAllUsers ¶
func (*MongoDBHandler) FindUserByID ¶
func (*MongoDBHandler) WithContext ¶
func (m *MongoDBHandler) WithContext(ctx context.Context) context.Context
WithContext is method apply mongoClient into context
type MongoDbInitProvider ¶
type MongoDbInitProvider interface { Disconnect(ctx context.Context) error Connect() gin.HandlerFunc WithContext(ctx context.Context) context.Context Collection(ctx context.Context, col string) (*mongo.Collection, error) FindAllUsers(ctx context.Context) ([]*domain.User, error) FindUserByID(ctx context.Context, id string) (*domain.User, error) SaveUser(ctx context.Context, newUser domain.NewUser) (*domain.User, error) DeleteUser(ctx context.Context, id string) (string, error) }
Click to show internal directories.
Click to hide internal directories.