Documentation ¶
Index ¶
- func ConnectMongoDB(ctx context.Context, dsn string, opts ...*options.ClientOptions) *mongo.Database
- func ConnectRedis(dsn string, opts ...RedisPoolOption) *redis.Pool
- func ConnectSQLDatabase(dsn string) *sql.DB
- func InitMongoDB(ctx context.Context, opts ...*options.ClientOptions) interfaces.MongoDatabase
- func InitRedis(opts ...RedisPoolOption) interfaces.RedisPool
- func InitSQLDatabase() interfaces.SQLDatabase
- func ParseSQLDSN(source string) (driverName string, dsn string)
- type RedisPoolOption
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ConnectMongoDB ¶ added in v1.6.10
func ConnectMongoDB(ctx context.Context, dsn string, opts ...*options.ClientOptions) *mongo.Database
ConnectMongoDB connect to mongodb with dsn
func ConnectRedis ¶ added in v1.6.10
func ConnectRedis(dsn string, opts ...RedisPoolOption) *redis.Pool
ConnectRedis connect to redis with dsn
func ConnectSQLDatabase ¶ added in v1.6.10
ConnectSQLDatabase connect to sql database with dsn
func InitMongoDB ¶
func InitMongoDB(ctx context.Context, opts ...*options.ClientOptions) interfaces.MongoDatabase
InitMongoDB return mongo db read & write instance from environment: MONGODB_HOST_WRITE, MONGODB_HOST_READ
func InitRedis ¶
func InitRedis(opts ...RedisPoolOption) interfaces.RedisPool
InitRedis connection from environment: REDIS_READ_DSN, REDIS_WRITE_DSN
func InitSQLDatabase ¶
func InitSQLDatabase() interfaces.SQLDatabase
InitSQLDatabase return sql db read & write instance from environment: SQL_DB_READ_DSN, SQL_DB_WRITE_DSN
func ParseSQLDSN ¶ added in v1.16.1
ParseSQLDSN parse sql dsn
Types ¶
type RedisPoolOption ¶ added in v1.17.0
func RedisPoolOptionSetIdleTimeout ¶ added in v1.17.0
func RedisPoolOptionSetIdleTimeout(dur time.Duration) RedisPoolOption
func RedisPoolOptionSetMaxActive ¶ added in v1.17.0
func RedisPoolOptionSetMaxActive(count int) RedisPoolOption
func RedisPoolOptionSetMaxConnLifetime ¶ added in v1.17.0
func RedisPoolOptionSetMaxConnLifetime(dur time.Duration) RedisPoolOption
func RedisPoolOptionSetMaxIdle ¶ added in v1.17.0
func RedisPoolOptionSetMaxIdle(count int) RedisPoolOption
Click to show internal directories.
Click to hide internal directories.