Skip to content
This repository was archived by the owner on Sep 29, 2024. It is now read-only.

Add DB option to RedisAdapterOptions #564

Merged

Conversation

ezerozen
Copy link
Contributor

@ezerozen ezerozen commented Feb 3, 2023

Add DB option to RedisAdapterOptions for specifies the database in redis.Dial

@sshaplygin
Copy link
Collaborator

@ezerozen Hey, Ezequiel! Thank you so match for your PR!

What's happened if we don't set DB options at the redis connection?

Copy link
Collaborator

@sshaplygin sshaplygin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@ezerozen
Copy link
Contributor Author

ezerozen commented Feb 6, 2023

@ezerozen Hey, Ezequiel! Thank you so match for your PR!

What's happened if we don't set DB options at the redis connection?

@sshaplygin If we don't set DB options it use the default database (0).

Redis databases are numbered from 0 to 15 and, by default, you connect to database 0 when you connect to your Redis instance. However, you can change the database you’re using with the select command after you connect.

If you set any database number greater 0, the client execute the select command:
https://github.com/gomodule/redigo/blob/d6854479365f0307560fa28e18e2bd0634b05229/redis/conn.go#L307-L312

@sshaplygin sshaplygin merged commit 0349c35 into googollee:master Feb 8, 2023
@ezerozen ezerozen deleted the enhancement/redis-adapter-ops-db branch February 8, 2023 14:06
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants