2024-07-15 20:06:22 +00:00
|
|
|
namespace BotSharp.Plugin.SqlDriver.Hooks;
|
|
|
|
|
|
2024-09-24 15:45:57 +00:00
|
|
|
public class SqlUtilityHook : IAgentUtilityHook
|
2024-07-15 20:06:22 +00:00
|
|
|
{
|
2024-12-04 22:12:02 +00:00
|
|
|
private const string PREFIX = "util-db-";
|
|
|
|
|
private const string SQL_TABLE_DEFINITION_FN = $"{PREFIX}sql_table_definition";
|
|
|
|
|
private const string VERIFY_DICTIONARY_TERM_FN = $"{PREFIX}verify_dictionary_term";
|
|
|
|
|
private const string SQL_SELECT_FN = $"{PREFIX}sql_select";
|
|
|
|
|
private const string SQL_EXECUTOR_FN = $"{PREFIX}sql_executor";
|
2024-11-21 06:50:55 +00:00
|
|
|
|
|
|
|
|
public void AddUtilities(List<AgentUtility> utilities)
|
2024-07-15 20:06:22 +00:00
|
|
|
{
|
2024-11-21 06:50:55 +00:00
|
|
|
var items = new List<AgentUtility>
|
|
|
|
|
{
|
|
|
|
|
new AgentUtility
|
|
|
|
|
{
|
2025-02-03 23:43:04 +00:00
|
|
|
Name = "db.tools",
|
|
|
|
|
Functions =
|
|
|
|
|
[
|
|
|
|
|
new(SQL_TABLE_DEFINITION_FN),
|
|
|
|
|
new(VERIFY_DICTIONARY_TERM_FN),
|
|
|
|
|
new(SQL_SELECT_FN),
|
|
|
|
|
],
|
|
|
|
|
Templates =
|
|
|
|
|
[
|
|
|
|
|
new($"{VERIFY_DICTIONARY_TERM_FN}.fn"),
|
|
|
|
|
new($"{SQL_TABLE_DEFINITION_FN}.fn"),
|
|
|
|
|
new($"{SQL_EXECUTOR_FN}.fn")
|
|
|
|
|
]
|
2024-11-21 06:50:55 +00:00
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
utilities.AddRange(items);
|
2024-07-15 20:06:22 +00:00
|
|
|
}
|
|
|
|
|
}
|