- java.lang.Object
-
- io.rxmicro.config.Config
-
- io.rxmicro.data.sql.SQLDatabaseConfig
-
- Direct Known Subclasses:
SQLPooledDatabaseConfig
public class SQLDatabaseConfig extends io.rxmicro.config.ConfigAllows configuring SQL DB options.- Since:
- 0.1
- Author:
- nedis
- See Also:
Duration
-
-
Constructor Summary
Constructors Constructor Description SQLDatabaseConfig()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description SQLDatabaseConfigaddOption(String name, String value)Adds the new db specific optionStringgetConnectionString()Returns the connection string built from schema, host, port and database parametersDurationgetConnectTimeout()Returns the connection timeoutStringgetDatabase()Returns the database nameStringgetHost()Returns the server host nameOptional<Map<String,String>>getOptions()Returns the db specific optionsCharSequencegetPassword()Returns the database passwordintgetPort()Returns the server portStringgetUser()Returns the database usernameSQLDatabaseConfigsetConnectTimeout(Duration connectTimeout)Sets the connection timeoutSQLDatabaseConfigsetDatabase(String database)Sets the database nameSQLDatabaseConfigsetHost(String host)Sets the server host nameSQLDatabaseConfigsetPassword(CharSequence password)Sets the database passwordSQLDatabaseConfigsetPort(int port)Sets the server portSQLDatabaseConfigsetUser(String user)Sets the database username
-
-
-
Method Detail
-
getHost
public String getHost()
Returns the server host name- Returns:
- the server host name
-
setHost
@BuilderMethod public SQLDatabaseConfig setHost(String host)
Sets the server host name- Parameters:
host- the server host name- Returns:
- the reference to this
SQLDatabaseConfiginstance
-
getPort
public int getPort()
Returns the server port- Returns:
- the server port
-
setPort
@BuilderMethod public SQLDatabaseConfig setPort(int port)
Sets the server port- Parameters:
port- the server port- Returns:
- the reference to this
SQLDatabaseConfiginstance
-
getUser
public String getUser()
Returns the database username- Returns:
- the database username
-
setUser
@BuilderMethod public SQLDatabaseConfig setUser(String user)
Sets the database username- Parameters:
user- the database username- Returns:
- the reference to this
SQLDatabaseConfiginstance
-
getPassword
public CharSequence getPassword()
Returns the database password- Returns:
- the database password
-
setPassword
@BuilderMethod public SQLDatabaseConfig setPassword(CharSequence password)
Sets the database password- Parameters:
password- the database password- Returns:
- the reference to this
SQLDatabaseConfiginstance
-
getDatabase
public String getDatabase()
Returns the database name- Returns:
- the database name
-
setDatabase
@BuilderMethod public SQLDatabaseConfig setDatabase(String database)
Sets the database name- Parameters:
database- the database name- Returns:
- the reference to this
SQLDatabaseConfiginstance
-
addOption
@BuilderMethod public SQLDatabaseConfig addOption(String name, String value)
Adds the new db specific option- Parameters:
name- the option namevalue- the option value- Returns:
- the reference to this
SQLDatabaseConfiginstance
-
getOptions
public Optional<Map<String,String>> getOptions()
Returns the db specific options- Returns:
- the db specific options
-
getConnectTimeout
public Duration getConnectTimeout()
Returns the connection timeout- Returns:
- the connection timeout
-
setConnectTimeout
@BuilderMethod public SQLDatabaseConfig setConnectTimeout(Duration connectTimeout)
Sets the connection timeout- Parameters:
connectTimeout- the connection timeout- Returns:
- the reference to this
SQLDatabaseConfiginstance
-
getConnectionString
public String getConnectionString()
Returns the connection string built from schema, host, port and database parameters- Returns:
- the connection string built from schema, host, port and database parameters
-
-