Procedure.ts
Procedure.ts overview
Section titled “Procedure.ts overview”Typed metadata builders for Microsoft SQL Server stored procedure calls.
This module defines the Procedure values consumed by MssqlClient.call.
make starts a procedure definition, param and outputParam add typed
Tedious parameter metadata, withRows sets the expected row type, and
compile binds input values before execution. The module also defines the
typed result shape for output parameters and returned rows.
Since v4.0.0
Exports Grouped by Category
Section titled “Exports Grouped by Category”combinators
Section titled “combinators”compile
Section titled “compile”Binds input values to a SQL Server stored procedure definition, producing a value that can be executed with MssqlClient.call.
Signature
declare const compile: < I extends Record<string, Parameter.Parameter<any>>, O extends Record<string, Parameter.Parameter<any>>, A>( self: Procedure<I, O, A>) => (input: Procedure.ParametersRecord<I>) => ProcedureWithValues<I, O, A>Since v4.0.0
outputParam
Section titled “outputParam”Adds a typed output parameter to a SQL Server stored procedure definition.
Signature
declare const outputParam: <A>() => <N extends string, T extends DataType>( name: N, type: T, options?: ParameterOptions) => <I extends Record<string, Parameter.Parameter<any>>, O extends Record<string, Parameter.Parameter<any>>>( self: Procedure<I, O>) => Procedure<I, Simplify<O & { [K in N]: Parameter.Parameter<A> }>>Since v4.0.0
Adds a typed input parameter to a SQL Server stored procedure definition.
Signature
declare const param: <A>() => <N extends string, T extends DataType>( name: N, type: T, options?: ParameterOptions) => <I extends Record<string, Parameter.Parameter<any>>, O extends Record<string, Parameter.Parameter<any>>>( self: Procedure<I, O>) => Procedure<Simplify<I & { [K in N]: Parameter.Parameter<A> }>, O>Since v4.0.0
withRows
Section titled “withRows”Sets the expected row type for a SQL Server stored procedure definition.
Signature
declare const withRows: <A extends object = Row>() => < I extends Record<string, Parameter.Parameter<any>>, O extends Record<string, Parameter.Parameter<any>>>( self: Procedure<I, O>) => Procedure<I, O, A>Since v4.0.0
constructors
Section titled “constructors”Creates an empty SQL Server stored procedure definition for the given procedure name.
Signature
declare const make: (name: string) => Procedure<{}, {}>Since v4.0.0
models
Section titled “models”Procedure (interface)
Section titled “Procedure (interface)”Pipeable definition of a SQL Server stored procedure, tracking its input parameters, output parameters, and result row type.
Signature
export interface Procedure< I extends Record<string, Parameter.Parameter<any>>, O extends Record<string, Parameter.Parameter<any>>, A = never> extends Pipeable { readonly [TypeId]: { readonly _A: Covariant<A> } readonly _tag: "Procedure" readonly name: string readonly params: I readonly outputParams: O}Since v4.0.0
ProcedureWithValues (interface)
Section titled “ProcedureWithValues (interface)”Stored procedure definition with concrete input values bound for execution.
Signature
export interface ProcedureWithValues< I extends Record<string, Parameter.Parameter<any>>, O extends Record<string, Parameter.Parameter<any>>, A> extends Procedure<I, O, A> { readonly values: Procedure.ParametersRecord<I>}Since v4.0.0
type IDs
Section titled “type IDs”TypeId
Section titled “TypeId”Runtime type identifier used to mark SQL Server stored procedure definitions.
Signature
declare const TypeId: "~@effect/sql-mssql/Procedure"Since v4.0.0
TypeId (type alias)
Section titled “TypeId (type alias)”Type-level identifier used to mark SQL Server stored procedure definitions.
Signature
type TypeId = "~@effect/sql-mssql/Procedure"Since v4.0.0
Procedure (namespace)
Section titled “Procedure (namespace)”Namespace containing type helpers and result types for SQL Server stored procedures.
Since v4.0.0
Result (interface)
Section titled “Result (interface)”Result of a SQL Server stored procedure call, containing typed output parameter values and returned rows.
Signature
export interface Result<O extends Record<string, Parameter.Parameter<any>>, A> { readonly output: ParametersRecord<O> readonly rows: ReadonlyArray<A>}Since v4.0.0
ParametersRecord (type alias)
Section titled “ParametersRecord (type alias)”Maps a record of Parameter metadata to the corresponding record of parameter value types.
Signature
type { readonly [K in keyof A]: A[K] extends Parameter.Parameter<infer T> ? T : never; } = & { readonly [K in keyof A]: A[K] extends Parameter.Parameter<infer T> ? T : never } & {}Since v4.0.0