|
| 1 | +// Copyright (c) .NET Foundation. All rights reserved. |
| 2 | +// Licensed under the MIT License. |
| 3 | + |
| 4 | +import { FunctionInput, FunctionOptions, FunctionOutput, FunctionResult, FunctionTrigger } from './index'; |
| 5 | +import { InvocationContext } from './InvocationContext'; |
| 6 | + |
| 7 | +export type MySqlHandler = (changes: MySqlChange[], context: InvocationContext) => FunctionResult; |
| 8 | + |
| 9 | +export interface MySqlFunctionOptions extends MySqlTriggerOptions, Partial<FunctionOptions> { |
| 10 | + handler: MySqlHandler; |
| 11 | + |
| 12 | + trigger?: MySqlTrigger; |
| 13 | +} |
| 14 | + |
| 15 | +export interface MySqlTriggerOptions { |
| 16 | + /** |
| 17 | + * The name of the table monitored by the trigger. |
| 18 | + */ |
| 19 | + tableName: string; |
| 20 | + |
| 21 | + /** |
| 22 | + * An app setting (or environment variable) with the connection string for the database containing the table monitored for changes |
| 23 | + */ |
| 24 | + connectionStringSetting: string; |
| 25 | +} |
| 26 | +export type MySqlTrigger = FunctionTrigger & MySqlTriggerOptions; |
| 27 | + |
| 28 | +export interface MySqlChange { |
| 29 | + Item: unknown; |
| 30 | + Operation: MySqlChangeOperation; |
| 31 | +} |
| 32 | + |
| 33 | +export enum MySqlChangeOperation { |
| 34 | + Update = 0, |
| 35 | +} |
| 36 | + |
| 37 | +export interface MySqlInputOptions { |
| 38 | + /** |
| 39 | + * The Transact-SQL query command or name of the stored procedure executed by the binding. |
| 40 | + */ |
| 41 | + commandText: string; |
| 42 | + |
| 43 | + /** |
| 44 | + * The command type value |
| 45 | + */ |
| 46 | + commandType: 'Text' | 'StoredProcedure'; |
| 47 | + |
| 48 | + /** |
| 49 | + * An app setting (or environment variable) with the connection string for the database against which the query or stored procedure is being executed |
| 50 | + */ |
| 51 | + connectionStringSetting: string; |
| 52 | + |
| 53 | + /** |
| 54 | + * Zero or more parameter values passed to the command during execution as a single string. |
| 55 | + * Must follow the format @param1=param1,@param2=param2. |
| 56 | + * Neither the parameter name nor the parameter value can contain a comma (,) or an equals sign (=). |
| 57 | + */ |
| 58 | + parameters?: string; |
| 59 | +} |
| 60 | +export type MySqlInput = FunctionInput & MySqlInputOptions; |
| 61 | + |
| 62 | +export interface MySqlOutputOptions { |
| 63 | + /** |
| 64 | + * The name of the table being written to by the binding. |
| 65 | + */ |
| 66 | + commandText: string; |
| 67 | + |
| 68 | + /** |
| 69 | + * An app setting (or environment variable) with the connection string for the database to which data is being written |
| 70 | + */ |
| 71 | + connectionStringSetting: string; |
| 72 | +} |
| 73 | +export type MySqlOutput = FunctionOutput & MySqlOutputOptions; |
0 commit comments