mongodb_client

package
v0.0.0-...-f19b43f Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 27, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MongoDbClient

type MongoDbClient struct {
	MongoDbClientConfig
	// contains filtered or unexported fields
}

func New

func New(name string, defaultDbName ...string) *MongoDbClient

func (*MongoDbClient) Client

func (m *MongoDbClient) Client() *mongo.Client

func (*MongoDbClient) Config

func (m *MongoDbClient) Config() interface{}

func (*MongoDbClient) Context

func (m *MongoDbClient) Context() context.Context

func (*MongoDbClient) DbName

func (m *MongoDbClient) DbName() string

func (*MongoDbClient) Init

func (m *MongoDbClient) Init(app app_context.Context, configPath ...string) error

func (*MongoDbClient) Name

func (m *MongoDbClient) Name() string

func (*MongoDbClient) Shutdown

func (m *MongoDbClient) Shutdown(ctx context.Context) error

type MongoDbClientConfig

type MongoDbClientConfig struct {
	MONGODB_URI string        `validate:"required" vmessage:"mongodb URI must be specified"`
	DB_NAME     string        `validate:"required" vmessage:"Name of database must be specified"`
	JSON_TAG    bool          `default:"true"`
	DEBUG       bool          `default:"false"`
	TIMEOUT     time.Duration `default:"30s"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL