blob: a69c095c12c34d1075fd48dcdc62d6477466e907 [file]
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
// Generated from bindings/java ServiceConfig definitions.
using OpenDAL.ServiceConfig.Abstractions;
namespace OpenDAL.ServiceConfig
{
/// <summary>
/// Configuration for service mysql.
/// </summary>
public sealed class MysqlServiceConfig : IServiceConfig
{
/// <summary>
/// This connection string is used to connect to the mysql service. There are url based formats. The format of connect string resembles the url format of the mysql client. The format is: [scheme://][user[:[password]]@]host[:port][/schema][?attribute1=value1&attribute2=value2... mysql://user@localhost mysql://user:password@localhost mysql://user:password@localhost:3306 mysql://user:password@localhost:3306/db For more information, please refer to https://docs.rs/sqlx/latest/sqlx/mysql/struct.MySqlConnectOptions.html .
/// </summary>
public string? ConnectionString { get; init; }
/// <summary>
/// The key field name for mysql.
/// </summary>
public string? KeyField { get; init; }
/// <summary>
/// The root for mysql.
/// </summary>
public string? Root { get; init; }
/// <summary>
/// The table name for mysql.
/// </summary>
public string? Table { get; init; }
/// <summary>
/// The value field name for mysql.
/// </summary>
public string? ValueField { get; init; }
public string Scheme => "mysql";
public IReadOnlyDictionary<string, string> ToOptions()
{
var map = new Dictionary<string, string>();
if (ConnectionString is not null)
{
map["connection_string"] = Utilities.ToOptionString(ConnectionString);
}
if (KeyField is not null)
{
map["key_field"] = Utilities.ToOptionString(KeyField);
}
if (Root is not null)
{
map["root"] = Utilities.ToOptionString(Root);
}
if (Table is not null)
{
map["table"] = Utilities.ToOptionString(Table);
}
if (ValueField is not null)
{
map["value_field"] = Utilities.ToOptionString(ValueField);
}
return map;
}
}
}