BotSharp/src/Plugins/BotSharp.Plugin.SqlDriver/Hooks/SqlUtilityHook.cs

36 lines
1.2 KiB
C#
Raw Normal View History

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-11-21 06:50:55 +00:00
private const string SQL_TABLE_DEFINITION_FN = "sql_table_definition";
private const string VERIFY_DICTIONARY_TERM_FN = "verify_dictionary_term";
private const string SQL_SELECT_FN = "sql_select";
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
{
Name = UtilityName.SqlTableDefinition,
Functions = [new(SQL_TABLE_DEFINITION_FN)],
Templates = [new($"{SQL_TABLE_DEFINITION_FN}.fn")]
},
new AgentUtility
{
Name = UtilityName.SqlDictionaryLookup,
Functions = [new(VERIFY_DICTIONARY_TERM_FN)],
Templates = [new($"{VERIFY_DICTIONARY_TERM_FN}.fn")]
},
new AgentUtility
{
Name = UtilityName.SqlExecutor,
2024-11-22 01:37:56 +00:00
Functions = [new(SQL_SELECT_FN), new(SQL_TABLE_DEFINITION_FN)],
Templates = [new($"sql_executor.fn")]
2024-11-21 06:50:55 +00:00
}
};
utilities.AddRange(items);
2024-07-15 20:06:22 +00:00
}
}