diff --git a/packages/example/src/books/BookService__sql.gen.tsx b/packages/example/src/books/BookService__sql.gen.tsx index a1694840..4b4c2436 100644 --- a/packages/example/src/books/BookService__sql.gen.tsx +++ b/packages/example/src/books/BookService__sql.gen.tsx @@ -87,10 +87,8 @@ export const FindBookById_many: (_1:PgTyped_Pg_Client_t, _2:findBookByIdParams) /** Returns exactly 1 result. Returns `None` if more or less than exactly 1 result is returned. */ export const FindBookById_one: (_1:PgTyped_Pg_Client_t, _2:findBookByIdParams) => Promise<(undefined | findBookByIdResult)> = BookService__sqlJS.FindBookById.one as any; -/** Returns exactly 1 result. Returns `Error` (with an optionally provided `errorMessage`) if more or less than exactly 1 result is returned. */ -export const FindBookById_expectOne: (_1:PgTyped_Pg_Client_t, _2:findBookByIdParams, errorMessage:(undefined | string)) => Promise< - { TAG: "Ok"; _0: findBookByIdResult } - | { TAG: "Error"; _0: string }> = BookService__sqlJS.FindBookById.expectOne as any; +/** Returns exactly 1 result. Raises `Exn.t` (with an optionally provided `errorMessage`) if more or less than exactly 1 result is returned. */ +export const FindBookById_expectOne: (_1:PgTyped_Pg_Client_t, _2:findBookByIdParams, errorMessage:(undefined | string)) => Promise = BookService__sqlJS.FindBookById.expectOne as any; /** Executes the query, but ignores whatever is returned by it. */ export const FindBookById_execute: (_1:PgTyped_Pg_Client_t, _2:findBookByIdParams) => Promise = BookService__sqlJS.FindBookById.execute as any; @@ -103,10 +101,8 @@ export const Query1_many: (_1:PgTyped_Pg_Client_t, _2:query1Params) => Promise Promise<(undefined | query1Result)> = BookService__sqlJS.Query1.one as any; -/** Returns exactly 1 result. Returns `Error` (with an optionally provided `errorMessage`) if more or less than exactly 1 result is returned. */ -export const Query1_expectOne: (_1:PgTyped_Pg_Client_t, _2:query1Params, errorMessage:(undefined | string)) => Promise< - { TAG: "Ok"; _0: query1Result } - | { TAG: "Error"; _0: string }> = BookService__sqlJS.Query1.expectOne as any; +/** Returns exactly 1 result. Raises `Exn.t` (with an optionally provided `errorMessage`) if more or less than exactly 1 result is returned. */ +export const Query1_expectOne: (_1:PgTyped_Pg_Client_t, _2:query1Params, errorMessage:(undefined | string)) => Promise = BookService__sqlJS.Query1.expectOne as any; /** Executes the query, but ignores whatever is returned by it. */ export const Query1_execute: (_1:PgTyped_Pg_Client_t, _2:query1Params) => Promise = BookService__sqlJS.Query1.execute as any; @@ -119,10 +115,8 @@ export const Query2_many: (_1:PgTyped_Pg_Client_t, _2:query2Params) => Promise Promise<(undefined | query2Result)> = BookService__sqlJS.Query2.one as any; -/** Returns exactly 1 result. Returns `Error` (with an optionally provided `errorMessage`) if more or less than exactly 1 result is returned. */ -export const Query2_expectOne: (_1:PgTyped_Pg_Client_t, _2:query2Params, errorMessage:(undefined | string)) => Promise< - { TAG: "Ok"; _0: query2Result } - | { TAG: "Error"; _0: string }> = BookService__sqlJS.Query2.expectOne as any; +/** Returns exactly 1 result. Raises `Exn.t` (with an optionally provided `errorMessage`) if more or less than exactly 1 result is returned. */ +export const Query2_expectOne: (_1:PgTyped_Pg_Client_t, _2:query2Params, errorMessage:(undefined | string)) => Promise = BookService__sqlJS.Query2.expectOne as any; /** Executes the query, but ignores whatever is returned by it. */ export const Query2_execute: (_1:PgTyped_Pg_Client_t, _2:query2Params) => Promise = BookService__sqlJS.Query2.execute as any; @@ -135,10 +129,8 @@ export const Query3_many: (_1:PgTyped_Pg_Client_t, _2:query3Params) => Promise Promise<(undefined | query3Result)> = BookService__sqlJS.Query3.one as any; -/** Returns exactly 1 result. Returns `Error` (with an optionally provided `errorMessage`) if more or less than exactly 1 result is returned. */ -export const Query3_expectOne: (_1:PgTyped_Pg_Client_t, _2:query3Params, errorMessage:(undefined | string)) => Promise< - { TAG: "Ok"; _0: query3Result } - | { TAG: "Error"; _0: string }> = BookService__sqlJS.Query3.expectOne as any; +/** Returns exactly 1 result. Raises `Exn.t` (with an optionally provided `errorMessage`) if more or less than exactly 1 result is returned. */ +export const Query3_expectOne: (_1:PgTyped_Pg_Client_t, _2:query3Params, errorMessage:(undefined | string)) => Promise = BookService__sqlJS.Query3.expectOne as any; /** Executes the query, but ignores whatever is returned by it. */ export const Query3_execute: (_1:PgTyped_Pg_Client_t, _2:query3Params) => Promise = BookService__sqlJS.Query3.execute as any; @@ -146,16 +138,8 @@ export const Query3_execute: (_1:PgTyped_Pg_Client_t, _2:query3Params) => Promis export const query3: (params:query3Params, client:PgTyped_Pg_Client_t) => Promise = BookService__sqlJS.query3 as any; export const FindBookById: { - /** Returns exactly 1 result. Returns `Error` (with an optionally provided `errorMessage`) if more or less than exactly 1 result is returned. */ - expectOne: (_1:PgTyped_Pg_Client_t, _2:findBookByIdParams, errorMessage:(undefined | string)) => Promise< - { - TAG: "Ok"; - _0: findBookByIdResult - } - | { - TAG: "Error"; - _0: string - }>; + /** Returns exactly 1 result. Raises `Exn.t` (with an optionally provided `errorMessage`) if more or less than exactly 1 result is returned. */ + expectOne: (_1:PgTyped_Pg_Client_t, _2:findBookByIdParams, errorMessage:(undefined | string)) => Promise; /** Returns exactly 1 result. Returns `None` if more or less than exactly 1 result is returned. */ one: (_1:PgTyped_Pg_Client_t, _2:findBookByIdParams) => Promise<(undefined | findBookByIdResult)>; /** Returns an array of all matched results. */ @@ -165,16 +149,8 @@ export const FindBookById: { } = BookService__sqlJS.FindBookById as any; export const Query1: { - /** Returns exactly 1 result. Returns `Error` (with an optionally provided `errorMessage`) if more or less than exactly 1 result is returned. */ - expectOne: (_1:PgTyped_Pg_Client_t, _2:query1Params, errorMessage:(undefined | string)) => Promise< - { - TAG: "Ok"; - _0: query1Result - } - | { - TAG: "Error"; - _0: string - }>; + /** Returns exactly 1 result. Raises `Exn.t` (with an optionally provided `errorMessage`) if more or less than exactly 1 result is returned. */ + expectOne: (_1:PgTyped_Pg_Client_t, _2:query1Params, errorMessage:(undefined | string)) => Promise; /** Returns exactly 1 result. Returns `None` if more or less than exactly 1 result is returned. */ one: (_1:PgTyped_Pg_Client_t, _2:query1Params) => Promise<(undefined | query1Result)>; /** Returns an array of all matched results. */ @@ -184,16 +160,8 @@ export const Query1: { } = BookService__sqlJS.Query1 as any; export const Query2: { - /** Returns exactly 1 result. Returns `Error` (with an optionally provided `errorMessage`) if more or less than exactly 1 result is returned. */ - expectOne: (_1:PgTyped_Pg_Client_t, _2:query2Params, errorMessage:(undefined | string)) => Promise< - { - TAG: "Ok"; - _0: query2Result - } - | { - TAG: "Error"; - _0: string - }>; + /** Returns exactly 1 result. Raises `Exn.t` (with an optionally provided `errorMessage`) if more or less than exactly 1 result is returned. */ + expectOne: (_1:PgTyped_Pg_Client_t, _2:query2Params, errorMessage:(undefined | string)) => Promise; /** Returns exactly 1 result. Returns `None` if more or less than exactly 1 result is returned. */ one: (_1:PgTyped_Pg_Client_t, _2:query2Params) => Promise<(undefined | query2Result)>; /** Returns an array of all matched results. */ @@ -203,16 +171,8 @@ export const Query2: { } = BookService__sqlJS.Query2 as any; export const Query3: { - /** Returns exactly 1 result. Returns `Error` (with an optionally provided `errorMessage`) if more or less than exactly 1 result is returned. */ - expectOne: (_1:PgTyped_Pg_Client_t, _2:query3Params, errorMessage:(undefined | string)) => Promise< - { - TAG: "Ok"; - _0: query3Result - } - | { - TAG: "Error"; - _0: string - }>; + /** Returns exactly 1 result. Raises `Exn.t` (with an optionally provided `errorMessage`) if more or less than exactly 1 result is returned. */ + expectOne: (_1:PgTyped_Pg_Client_t, _2:query3Params, errorMessage:(undefined | string)) => Promise; /** Returns exactly 1 result. Returns `None` if more or less than exactly 1 result is returned. */ one: (_1:PgTyped_Pg_Client_t, _2:query3Params) => Promise<(undefined | query3Result)>; /** Returns an array of all matched results. */ diff --git a/packages/example/src/books/books__sql.gen.tsx b/packages/example/src/books/books__sql.gen.tsx index e3416f09..f9e82435 100644 --- a/packages/example/src/books/books__sql.gen.tsx +++ b/packages/example/src/books/books__sql.gen.tsx @@ -427,10 +427,8 @@ export const FindBookById_many: (_1:PgTyped_Pg_Client_t, _2:findBookByIdParams) /** Returns exactly 1 result. Returns `None` if more or less than exactly 1 result is returned. */ export const FindBookById_one: (_1:PgTyped_Pg_Client_t, _2:findBookByIdParams) => Promise<(undefined | findBookByIdResult)> = books__sqlJS.FindBookById.one as any; -/** Returns exactly 1 result. Returns `Error` (with an optionally provided `errorMessage`) if more or less than exactly 1 result is returned. */ -export const FindBookById_expectOne: (_1:PgTyped_Pg_Client_t, _2:findBookByIdParams, errorMessage:(undefined | string)) => Promise< - { TAG: "Ok"; _0: findBookByIdResult } - | { TAG: "Error"; _0: string }> = books__sqlJS.FindBookById.expectOne as any; +/** Returns exactly 1 result. Raises `Exn.t` (with an optionally provided `errorMessage`) if more or less than exactly 1 result is returned. */ +export const FindBookById_expectOne: (_1:PgTyped_Pg_Client_t, _2:findBookByIdParams, errorMessage:(undefined | string)) => Promise = books__sqlJS.FindBookById.expectOne as any; /** Executes the query, but ignores whatever is returned by it. */ export const FindBookById_execute: (_1:PgTyped_Pg_Client_t, _2:findBookByIdParams) => Promise = books__sqlJS.FindBookById.execute as any; @@ -443,10 +441,8 @@ export const FindBookByCategory_many: (_1:PgTyped_Pg_Client_t, _2:findBookByCate /** Returns exactly 1 result. Returns `None` if more or less than exactly 1 result is returned. */ export const FindBookByCategory_one: (_1:PgTyped_Pg_Client_t, _2:findBookByCategoryParams) => Promise<(undefined | findBookByCategoryResult)> = books__sqlJS.FindBookByCategory.one as any; -/** Returns exactly 1 result. Returns `Error` (with an optionally provided `errorMessage`) if more or less than exactly 1 result is returned. */ -export const FindBookByCategory_expectOne: (_1:PgTyped_Pg_Client_t, _2:findBookByCategoryParams, errorMessage:(undefined | string)) => Promise< - { TAG: "Ok"; _0: findBookByCategoryResult } - | { TAG: "Error"; _0: string }> = books__sqlJS.FindBookByCategory.expectOne as any; +/** Returns exactly 1 result. Raises `Exn.t` (with an optionally provided `errorMessage`) if more or less than exactly 1 result is returned. */ +export const FindBookByCategory_expectOne: (_1:PgTyped_Pg_Client_t, _2:findBookByCategoryParams, errorMessage:(undefined | string)) => Promise = books__sqlJS.FindBookByCategory.expectOne as any; /** Executes the query, but ignores whatever is returned by it. */ export const FindBookByCategory_execute: (_1:PgTyped_Pg_Client_t, _2:findBookByCategoryParams) => Promise = books__sqlJS.FindBookByCategory.execute as any; @@ -459,10 +455,8 @@ export const FindBookNameOrRank_many: (_1:PgTyped_Pg_Client_t, _2:findBookNameOr /** Returns exactly 1 result. Returns `None` if more or less than exactly 1 result is returned. */ export const FindBookNameOrRank_one: (_1:PgTyped_Pg_Client_t, _2:findBookNameOrRankParams) => Promise<(undefined | findBookNameOrRankResult)> = books__sqlJS.FindBookNameOrRank.one as any; -/** Returns exactly 1 result. Returns `Error` (with an optionally provided `errorMessage`) if more or less than exactly 1 result is returned. */ -export const FindBookNameOrRank_expectOne: (_1:PgTyped_Pg_Client_t, _2:findBookNameOrRankParams, errorMessage:(undefined | string)) => Promise< - { TAG: "Ok"; _0: findBookNameOrRankResult } - | { TAG: "Error"; _0: string }> = books__sqlJS.FindBookNameOrRank.expectOne as any; +/** Returns exactly 1 result. Raises `Exn.t` (with an optionally provided `errorMessage`) if more or less than exactly 1 result is returned. */ +export const FindBookNameOrRank_expectOne: (_1:PgTyped_Pg_Client_t, _2:findBookNameOrRankParams, errorMessage:(undefined | string)) => Promise = books__sqlJS.FindBookNameOrRank.expectOne as any; /** Executes the query, but ignores whatever is returned by it. */ export const FindBookNameOrRank_execute: (_1:PgTyped_Pg_Client_t, _2:findBookNameOrRankParams) => Promise = books__sqlJS.FindBookNameOrRank.execute as any; @@ -475,10 +469,8 @@ export const FindBookUnicode_many: (_1:PgTyped_Pg_Client_t, _2:findBookUnicodePa /** Returns exactly 1 result. Returns `None` if more or less than exactly 1 result is returned. */ export const FindBookUnicode_one: (_1:PgTyped_Pg_Client_t, _2:findBookUnicodeParams) => Promise<(undefined | findBookUnicodeResult)> = books__sqlJS.FindBookUnicode.one as any; -/** Returns exactly 1 result. Returns `Error` (with an optionally provided `errorMessage`) if more or less than exactly 1 result is returned. */ -export const FindBookUnicode_expectOne: (_1:PgTyped_Pg_Client_t, _2:findBookUnicodeParams, errorMessage:(undefined | string)) => Promise< - { TAG: "Ok"; _0: findBookUnicodeResult } - | { TAG: "Error"; _0: string }> = books__sqlJS.FindBookUnicode.expectOne as any; +/** Returns exactly 1 result. Raises `Exn.t` (with an optionally provided `errorMessage`) if more or less than exactly 1 result is returned. */ +export const FindBookUnicode_expectOne: (_1:PgTyped_Pg_Client_t, _2:findBookUnicodeParams, errorMessage:(undefined | string)) => Promise = books__sqlJS.FindBookUnicode.expectOne as any; /** Executes the query, but ignores whatever is returned by it. */ export const FindBookUnicode_execute: (_1:PgTyped_Pg_Client_t, _2:findBookUnicodeParams) => Promise = books__sqlJS.FindBookUnicode.execute as any; @@ -491,10 +483,8 @@ export const InsertBooks_many: (_1:PgTyped_Pg_Client_t, _2:insertBooksParams) => /** Returns exactly 1 result. Returns `None` if more or less than exactly 1 result is returned. */ export const InsertBooks_one: (_1:PgTyped_Pg_Client_t, _2:insertBooksParams) => Promise<(undefined | insertBooksResult)> = books__sqlJS.InsertBooks.one as any; -/** Returns exactly 1 result. Returns `Error` (with an optionally provided `errorMessage`) if more or less than exactly 1 result is returned. */ -export const InsertBooks_expectOne: (_1:PgTyped_Pg_Client_t, _2:insertBooksParams, errorMessage:(undefined | string)) => Promise< - { TAG: "Ok"; _0: insertBooksResult } - | { TAG: "Error"; _0: string }> = books__sqlJS.InsertBooks.expectOne as any; +/** Returns exactly 1 result. Raises `Exn.t` (with an optionally provided `errorMessage`) if more or less than exactly 1 result is returned. */ +export const InsertBooks_expectOne: (_1:PgTyped_Pg_Client_t, _2:insertBooksParams, errorMessage:(undefined | string)) => Promise = books__sqlJS.InsertBooks.expectOne as any; /** Executes the query, but ignores whatever is returned by it. */ export const InsertBooks_execute: (_1:PgTyped_Pg_Client_t, _2:insertBooksParams) => Promise = books__sqlJS.InsertBooks.execute as any; @@ -507,10 +497,8 @@ export const InsertBook_many: (_1:PgTyped_Pg_Client_t, _2:insertBookParams) => P /** Returns exactly 1 result. Returns `None` if more or less than exactly 1 result is returned. */ export const InsertBook_one: (_1:PgTyped_Pg_Client_t, _2:insertBookParams) => Promise<(undefined | insertBookResult)> = books__sqlJS.InsertBook.one as any; -/** Returns exactly 1 result. Returns `Error` (with an optionally provided `errorMessage`) if more or less than exactly 1 result is returned. */ -export const InsertBook_expectOne: (_1:PgTyped_Pg_Client_t, _2:insertBookParams, errorMessage:(undefined | string)) => Promise< - { TAG: "Ok"; _0: insertBookResult } - | { TAG: "Error"; _0: string }> = books__sqlJS.InsertBook.expectOne as any; +/** Returns exactly 1 result. Raises `Exn.t` (with an optionally provided `errorMessage`) if more or less than exactly 1 result is returned. */ +export const InsertBook_expectOne: (_1:PgTyped_Pg_Client_t, _2:insertBookParams, errorMessage:(undefined | string)) => Promise = books__sqlJS.InsertBook.expectOne as any; /** Executes the query, but ignores whatever is returned by it. */ export const InsertBook_execute: (_1:PgTyped_Pg_Client_t, _2:insertBookParams) => Promise = books__sqlJS.InsertBook.execute as any; @@ -523,10 +511,8 @@ export const UpdateBooksCustom_many: (_1:PgTyped_Pg_Client_t, _2:updateBooksCust /** Returns exactly 1 result. Returns `None` if more or less than exactly 1 result is returned. */ export const UpdateBooksCustom_one: (_1:PgTyped_Pg_Client_t, _2:updateBooksCustomParams) => Promise<(undefined | updateBooksCustomResult)> = books__sqlJS.UpdateBooksCustom.one as any; -/** Returns exactly 1 result. Returns `Error` (with an optionally provided `errorMessage`) if more or less than exactly 1 result is returned. */ -export const UpdateBooksCustom_expectOne: (_1:PgTyped_Pg_Client_t, _2:updateBooksCustomParams, errorMessage:(undefined | string)) => Promise< - { TAG: "Ok"; _0: updateBooksCustomResult } - | { TAG: "Error"; _0: string }> = books__sqlJS.UpdateBooksCustom.expectOne as any; +/** Returns exactly 1 result. Raises `Exn.t` (with an optionally provided `errorMessage`) if more or less than exactly 1 result is returned. */ +export const UpdateBooksCustom_expectOne: (_1:PgTyped_Pg_Client_t, _2:updateBooksCustomParams, errorMessage:(undefined | string)) => Promise = books__sqlJS.UpdateBooksCustom.expectOne as any; /** Executes the query, but ignores whatever is returned by it. */ export const UpdateBooksCustom_execute: (_1:PgTyped_Pg_Client_t, _2:updateBooksCustomParams) => Promise = books__sqlJS.UpdateBooksCustom.execute as any; @@ -539,10 +525,8 @@ export const UpdateBooks_many: (_1:PgTyped_Pg_Client_t, _2:updateBooksParams) => /** Returns exactly 1 result. Returns `None` if more or less than exactly 1 result is returned. */ export const UpdateBooks_one: (_1:PgTyped_Pg_Client_t, _2:updateBooksParams) => Promise<(undefined | updateBooksResult)> = books__sqlJS.UpdateBooks.one as any; -/** Returns exactly 1 result. Returns `Error` (with an optionally provided `errorMessage`) if more or less than exactly 1 result is returned. */ -export const UpdateBooks_expectOne: (_1:PgTyped_Pg_Client_t, _2:updateBooksParams, errorMessage:(undefined | string)) => Promise< - { TAG: "Ok"; _0: updateBooksResult } - | { TAG: "Error"; _0: string }> = books__sqlJS.UpdateBooks.expectOne as any; +/** Returns exactly 1 result. Raises `Exn.t` (with an optionally provided `errorMessage`) if more or less than exactly 1 result is returned. */ +export const UpdateBooks_expectOne: (_1:PgTyped_Pg_Client_t, _2:updateBooksParams, errorMessage:(undefined | string)) => Promise = books__sqlJS.UpdateBooks.expectOne as any; /** Executes the query, but ignores whatever is returned by it. */ export const UpdateBooks_execute: (_1:PgTyped_Pg_Client_t, _2:updateBooksParams) => Promise = books__sqlJS.UpdateBooks.execute as any; @@ -555,10 +539,8 @@ export const UpdateBooksRankNotNull_many: (_1:PgTyped_Pg_Client_t, _2:updateBook /** Returns exactly 1 result. Returns `None` if more or less than exactly 1 result is returned. */ export const UpdateBooksRankNotNull_one: (_1:PgTyped_Pg_Client_t, _2:updateBooksRankNotNullParams) => Promise<(undefined | updateBooksRankNotNullResult)> = books__sqlJS.UpdateBooksRankNotNull.one as any; -/** Returns exactly 1 result. Returns `Error` (with an optionally provided `errorMessage`) if more or less than exactly 1 result is returned. */ -export const UpdateBooksRankNotNull_expectOne: (_1:PgTyped_Pg_Client_t, _2:updateBooksRankNotNullParams, errorMessage:(undefined | string)) => Promise< - { TAG: "Ok"; _0: updateBooksRankNotNullResult } - | { TAG: "Error"; _0: string }> = books__sqlJS.UpdateBooksRankNotNull.expectOne as any; +/** Returns exactly 1 result. Raises `Exn.t` (with an optionally provided `errorMessage`) if more or less than exactly 1 result is returned. */ +export const UpdateBooksRankNotNull_expectOne: (_1:PgTyped_Pg_Client_t, _2:updateBooksRankNotNullParams, errorMessage:(undefined | string)) => Promise = books__sqlJS.UpdateBooksRankNotNull.expectOne as any; /** Executes the query, but ignores whatever is returned by it. */ export const UpdateBooksRankNotNull_execute: (_1:PgTyped_Pg_Client_t, _2:updateBooksRankNotNullParams) => Promise = books__sqlJS.UpdateBooksRankNotNull.execute as any; @@ -571,10 +553,8 @@ export const GetBooksByAuthorName_many: (_1:PgTyped_Pg_Client_t, _2:getBooksByAu /** Returns exactly 1 result. Returns `None` if more or less than exactly 1 result is returned. */ export const GetBooksByAuthorName_one: (_1:PgTyped_Pg_Client_t, _2:getBooksByAuthorNameParams) => Promise<(undefined | getBooksByAuthorNameResult)> = books__sqlJS.GetBooksByAuthorName.one as any; -/** Returns exactly 1 result. Returns `Error` (with an optionally provided `errorMessage`) if more or less than exactly 1 result is returned. */ -export const GetBooksByAuthorName_expectOne: (_1:PgTyped_Pg_Client_t, _2:getBooksByAuthorNameParams, errorMessage:(undefined | string)) => Promise< - { TAG: "Ok"; _0: getBooksByAuthorNameResult } - | { TAG: "Error"; _0: string }> = books__sqlJS.GetBooksByAuthorName.expectOne as any; +/** Returns exactly 1 result. Raises `Exn.t` (with an optionally provided `errorMessage`) if more or less than exactly 1 result is returned. */ +export const GetBooksByAuthorName_expectOne: (_1:PgTyped_Pg_Client_t, _2:getBooksByAuthorNameParams, errorMessage:(undefined | string)) => Promise = books__sqlJS.GetBooksByAuthorName.expectOne as any; /** Executes the query, but ignores whatever is returned by it. */ export const GetBooksByAuthorName_execute: (_1:PgTyped_Pg_Client_t, _2:getBooksByAuthorNameParams) => Promise = books__sqlJS.GetBooksByAuthorName.execute as any; @@ -587,10 +567,8 @@ export const AggregateEmailsAndTest_many: (_1:PgTyped_Pg_Client_t, _2:aggregateE /** Returns exactly 1 result. Returns `None` if more or less than exactly 1 result is returned. */ export const AggregateEmailsAndTest_one: (_1:PgTyped_Pg_Client_t, _2:aggregateEmailsAndTestParams) => Promise<(undefined | aggregateEmailsAndTestResult)> = books__sqlJS.AggregateEmailsAndTest.one as any; -/** Returns exactly 1 result. Returns `Error` (with an optionally provided `errorMessage`) if more or less than exactly 1 result is returned. */ -export const AggregateEmailsAndTest_expectOne: (_1:PgTyped_Pg_Client_t, _2:aggregateEmailsAndTestParams, errorMessage:(undefined | string)) => Promise< - { TAG: "Ok"; _0: aggregateEmailsAndTestResult } - | { TAG: "Error"; _0: string }> = books__sqlJS.AggregateEmailsAndTest.expectOne as any; +/** Returns exactly 1 result. Raises `Exn.t` (with an optionally provided `errorMessage`) if more or less than exactly 1 result is returned. */ +export const AggregateEmailsAndTest_expectOne: (_1:PgTyped_Pg_Client_t, _2:aggregateEmailsAndTestParams, errorMessage:(undefined | string)) => Promise = books__sqlJS.AggregateEmailsAndTest.expectOne as any; /** Executes the query, but ignores whatever is returned by it. */ export const AggregateEmailsAndTest_execute: (_1:PgTyped_Pg_Client_t, _2:aggregateEmailsAndTestParams) => Promise = books__sqlJS.AggregateEmailsAndTest.execute as any; @@ -603,10 +581,8 @@ export const GetBooks_many: (_1:PgTyped_Pg_Client_t, _2:getBooksParams) => Promi /** Returns exactly 1 result. Returns `None` if more or less than exactly 1 result is returned. */ export const GetBooks_one: (_1:PgTyped_Pg_Client_t, _2:getBooksParams) => Promise<(undefined | getBooksResult)> = books__sqlJS.GetBooks.one as any; -/** Returns exactly 1 result. Returns `Error` (with an optionally provided `errorMessage`) if more or less than exactly 1 result is returned. */ -export const GetBooks_expectOne: (_1:PgTyped_Pg_Client_t, _2:getBooksParams, errorMessage:(undefined | string)) => Promise< - { TAG: "Ok"; _0: getBooksResult } - | { TAG: "Error"; _0: string }> = books__sqlJS.GetBooks.expectOne as any; +/** Returns exactly 1 result. Raises `Exn.t` (with an optionally provided `errorMessage`) if more or less than exactly 1 result is returned. */ +export const GetBooks_expectOne: (_1:PgTyped_Pg_Client_t, _2:getBooksParams, errorMessage:(undefined | string)) => Promise = books__sqlJS.GetBooks.expectOne as any; /** Executes the query, but ignores whatever is returned by it. */ export const GetBooks_execute: (_1:PgTyped_Pg_Client_t, _2:getBooksParams) => Promise = books__sqlJS.GetBooks.execute as any; @@ -619,10 +595,8 @@ export const CountBooks_many: (_1:PgTyped_Pg_Client_t, _2:countBooksParams) => P /** Returns exactly 1 result. Returns `None` if more or less than exactly 1 result is returned. */ export const CountBooks_one: (_1:PgTyped_Pg_Client_t, _2:countBooksParams) => Promise<(undefined | countBooksResult)> = books__sqlJS.CountBooks.one as any; -/** Returns exactly 1 result. Returns `Error` (with an optionally provided `errorMessage`) if more or less than exactly 1 result is returned. */ -export const CountBooks_expectOne: (_1:PgTyped_Pg_Client_t, _2:countBooksParams, errorMessage:(undefined | string)) => Promise< - { TAG: "Ok"; _0: countBooksResult } - | { TAG: "Error"; _0: string }> = books__sqlJS.CountBooks.expectOne as any; +/** Returns exactly 1 result. Raises `Exn.t` (with an optionally provided `errorMessage`) if more or less than exactly 1 result is returned. */ +export const CountBooks_expectOne: (_1:PgTyped_Pg_Client_t, _2:countBooksParams, errorMessage:(undefined | string)) => Promise = books__sqlJS.CountBooks.expectOne as any; /** Executes the query, but ignores whatever is returned by it. */ export const CountBooks_execute: (_1:PgTyped_Pg_Client_t, _2:countBooksParams) => Promise = books__sqlJS.CountBooks.execute as any; @@ -635,10 +609,8 @@ export const GetBookCountries_many: (_1:PgTyped_Pg_Client_t, _2:getBookCountries /** Returns exactly 1 result. Returns `None` if more or less than exactly 1 result is returned. */ export const GetBookCountries_one: (_1:PgTyped_Pg_Client_t, _2:getBookCountriesParams) => Promise<(undefined | getBookCountriesResult)> = books__sqlJS.GetBookCountries.one as any; -/** Returns exactly 1 result. Returns `Error` (with an optionally provided `errorMessage`) if more or less than exactly 1 result is returned. */ -export const GetBookCountries_expectOne: (_1:PgTyped_Pg_Client_t, _2:getBookCountriesParams, errorMessage:(undefined | string)) => Promise< - { TAG: "Ok"; _0: getBookCountriesResult } - | { TAG: "Error"; _0: string }> = books__sqlJS.GetBookCountries.expectOne as any; +/** Returns exactly 1 result. Raises `Exn.t` (with an optionally provided `errorMessage`) if more or less than exactly 1 result is returned. */ +export const GetBookCountries_expectOne: (_1:PgTyped_Pg_Client_t, _2:getBookCountriesParams, errorMessage:(undefined | string)) => Promise = books__sqlJS.GetBookCountries.expectOne as any; /** Executes the query, but ignores whatever is returned by it. */ export const GetBookCountries_execute: (_1:PgTyped_Pg_Client_t, _2:getBookCountriesParams) => Promise = books__sqlJS.GetBookCountries.execute as any; @@ -646,16 +618,8 @@ export const GetBookCountries_execute: (_1:PgTyped_Pg_Client_t, _2:getBookCountr export const getBookCountries: (params:getBookCountriesParams, client:PgTyped_Pg_Client_t) => Promise = books__sqlJS.getBookCountries as any; export const FindBookNameOrRank: { - /** Returns exactly 1 result. Returns `Error` (with an optionally provided `errorMessage`) if more or less than exactly 1 result is returned. */ - expectOne: (_1:PgTyped_Pg_Client_t, _2:findBookNameOrRankParams, errorMessage:(undefined | string)) => Promise< - { - TAG: "Ok"; - _0: findBookNameOrRankResult - } - | { - TAG: "Error"; - _0: string - }>; + /** Returns exactly 1 result. Raises `Exn.t` (with an optionally provided `errorMessage`) if more or less than exactly 1 result is returned. */ + expectOne: (_1:PgTyped_Pg_Client_t, _2:findBookNameOrRankParams, errorMessage:(undefined | string)) => Promise; /** Returns exactly 1 result. Returns `None` if more or less than exactly 1 result is returned. */ one: (_1:PgTyped_Pg_Client_t, _2:findBookNameOrRankParams) => Promise<(undefined | findBookNameOrRankResult)>; /** Returns an array of all matched results. */ @@ -665,16 +629,8 @@ export const FindBookNameOrRank: { } = books__sqlJS.FindBookNameOrRank as any; export const UpdateBooks: { - /** Returns exactly 1 result. Returns `Error` (with an optionally provided `errorMessage`) if more or less than exactly 1 result is returned. */ - expectOne: (_1:PgTyped_Pg_Client_t, _2:updateBooksParams, errorMessage:(undefined | string)) => Promise< - { - TAG: "Ok"; - _0: updateBooksResult - } - | { - TAG: "Error"; - _0: string - }>; + /** Returns exactly 1 result. Raises `Exn.t` (with an optionally provided `errorMessage`) if more or less than exactly 1 result is returned. */ + expectOne: (_1:PgTyped_Pg_Client_t, _2:updateBooksParams, errorMessage:(undefined | string)) => Promise; /** Returns exactly 1 result. Returns `None` if more or less than exactly 1 result is returned. */ one: (_1:PgTyped_Pg_Client_t, _2:updateBooksParams) => Promise<(undefined | updateBooksResult)>; /** Returns an array of all matched results. */ @@ -684,16 +640,8 @@ export const UpdateBooks: { } = books__sqlJS.UpdateBooks as any; export const InsertBook: { - /** Returns exactly 1 result. Returns `Error` (with an optionally provided `errorMessage`) if more or less than exactly 1 result is returned. */ - expectOne: (_1:PgTyped_Pg_Client_t, _2:insertBookParams, errorMessage:(undefined | string)) => Promise< - { - TAG: "Ok"; - _0: insertBookResult - } - | { - TAG: "Error"; - _0: string - }>; + /** Returns exactly 1 result. Raises `Exn.t` (with an optionally provided `errorMessage`) if more or less than exactly 1 result is returned. */ + expectOne: (_1:PgTyped_Pg_Client_t, _2:insertBookParams, errorMessage:(undefined | string)) => Promise; /** Returns exactly 1 result. Returns `None` if more or less than exactly 1 result is returned. */ one: (_1:PgTyped_Pg_Client_t, _2:insertBookParams) => Promise<(undefined | insertBookResult)>; /** Returns an array of all matched results. */ @@ -703,16 +651,8 @@ export const InsertBook: { } = books__sqlJS.InsertBook as any; export const FindBookByCategory: { - /** Returns exactly 1 result. Returns `Error` (with an optionally provided `errorMessage`) if more or less than exactly 1 result is returned. */ - expectOne: (_1:PgTyped_Pg_Client_t, _2:findBookByCategoryParams, errorMessage:(undefined | string)) => Promise< - { - TAG: "Ok"; - _0: findBookByCategoryResult - } - | { - TAG: "Error"; - _0: string - }>; + /** Returns exactly 1 result. Raises `Exn.t` (with an optionally provided `errorMessage`) if more or less than exactly 1 result is returned. */ + expectOne: (_1:PgTyped_Pg_Client_t, _2:findBookByCategoryParams, errorMessage:(undefined | string)) => Promise; /** Returns exactly 1 result. Returns `None` if more or less than exactly 1 result is returned. */ one: (_1:PgTyped_Pg_Client_t, _2:findBookByCategoryParams) => Promise<(undefined | findBookByCategoryResult)>; /** Returns an array of all matched results. */ @@ -722,16 +662,8 @@ export const FindBookByCategory: { } = books__sqlJS.FindBookByCategory as any; export const AggregateEmailsAndTest: { - /** Returns exactly 1 result. Returns `Error` (with an optionally provided `errorMessage`) if more or less than exactly 1 result is returned. */ - expectOne: (_1:PgTyped_Pg_Client_t, _2:aggregateEmailsAndTestParams, errorMessage:(undefined | string)) => Promise< - { - TAG: "Ok"; - _0: aggregateEmailsAndTestResult - } - | { - TAG: "Error"; - _0: string - }>; + /** Returns exactly 1 result. Raises `Exn.t` (with an optionally provided `errorMessage`) if more or less than exactly 1 result is returned. */ + expectOne: (_1:PgTyped_Pg_Client_t, _2:aggregateEmailsAndTestParams, errorMessage:(undefined | string)) => Promise; /** Returns exactly 1 result. Returns `None` if more or less than exactly 1 result is returned. */ one: (_1:PgTyped_Pg_Client_t, _2:aggregateEmailsAndTestParams) => Promise<(undefined | aggregateEmailsAndTestResult)>; /** Returns an array of all matched results. */ @@ -741,16 +673,8 @@ export const AggregateEmailsAndTest: { } = books__sqlJS.AggregateEmailsAndTest as any; export const CountBooks: { - /** Returns exactly 1 result. Returns `Error` (with an optionally provided `errorMessage`) if more or less than exactly 1 result is returned. */ - expectOne: (_1:PgTyped_Pg_Client_t, _2:countBooksParams, errorMessage:(undefined | string)) => Promise< - { - TAG: "Ok"; - _0: countBooksResult - } - | { - TAG: "Error"; - _0: string - }>; + /** Returns exactly 1 result. Raises `Exn.t` (with an optionally provided `errorMessage`) if more or less than exactly 1 result is returned. */ + expectOne: (_1:PgTyped_Pg_Client_t, _2:countBooksParams, errorMessage:(undefined | string)) => Promise; /** Returns exactly 1 result. Returns `None` if more or less than exactly 1 result is returned. */ one: (_1:PgTyped_Pg_Client_t, _2:countBooksParams) => Promise<(undefined | countBooksResult)>; /** Returns an array of all matched results. */ @@ -760,16 +684,8 @@ export const CountBooks: { } = books__sqlJS.CountBooks as any; export const GetBooksByAuthorName: { - /** Returns exactly 1 result. Returns `Error` (with an optionally provided `errorMessage`) if more or less than exactly 1 result is returned. */ - expectOne: (_1:PgTyped_Pg_Client_t, _2:getBooksByAuthorNameParams, errorMessage:(undefined | string)) => Promise< - { - TAG: "Ok"; - _0: getBooksByAuthorNameResult - } - | { - TAG: "Error"; - _0: string - }>; + /** Returns exactly 1 result. Raises `Exn.t` (with an optionally provided `errorMessage`) if more or less than exactly 1 result is returned. */ + expectOne: (_1:PgTyped_Pg_Client_t, _2:getBooksByAuthorNameParams, errorMessage:(undefined | string)) => Promise; /** Returns exactly 1 result. Returns `None` if more or less than exactly 1 result is returned. */ one: (_1:PgTyped_Pg_Client_t, _2:getBooksByAuthorNameParams) => Promise<(undefined | getBooksByAuthorNameResult)>; /** Returns an array of all matched results. */ @@ -779,16 +695,8 @@ export const GetBooksByAuthorName: { } = books__sqlJS.GetBooksByAuthorName as any; export const FindBookById: { - /** Returns exactly 1 result. Returns `Error` (with an optionally provided `errorMessage`) if more or less than exactly 1 result is returned. */ - expectOne: (_1:PgTyped_Pg_Client_t, _2:findBookByIdParams, errorMessage:(undefined | string)) => Promise< - { - TAG: "Ok"; - _0: findBookByIdResult - } - | { - TAG: "Error"; - _0: string - }>; + /** Returns exactly 1 result. Raises `Exn.t` (with an optionally provided `errorMessage`) if more or less than exactly 1 result is returned. */ + expectOne: (_1:PgTyped_Pg_Client_t, _2:findBookByIdParams, errorMessage:(undefined | string)) => Promise; /** Returns exactly 1 result. Returns `None` if more or less than exactly 1 result is returned. */ one: (_1:PgTyped_Pg_Client_t, _2:findBookByIdParams) => Promise<(undefined | findBookByIdResult)>; /** Returns an array of all matched results. */ @@ -798,16 +706,8 @@ export const FindBookById: { } = books__sqlJS.FindBookById as any; export const GetBooks: { - /** Returns exactly 1 result. Returns `Error` (with an optionally provided `errorMessage`) if more or less than exactly 1 result is returned. */ - expectOne: (_1:PgTyped_Pg_Client_t, _2:getBooksParams, errorMessage:(undefined | string)) => Promise< - { - TAG: "Ok"; - _0: getBooksResult - } - | { - TAG: "Error"; - _0: string - }>; + /** Returns exactly 1 result. Raises `Exn.t` (with an optionally provided `errorMessage`) if more or less than exactly 1 result is returned. */ + expectOne: (_1:PgTyped_Pg_Client_t, _2:getBooksParams, errorMessage:(undefined | string)) => Promise; /** Returns exactly 1 result. Returns `None` if more or less than exactly 1 result is returned. */ one: (_1:PgTyped_Pg_Client_t, _2:getBooksParams) => Promise<(undefined | getBooksResult)>; /** Returns an array of all matched results. */ @@ -817,16 +717,8 @@ export const GetBooks: { } = books__sqlJS.GetBooks as any; export const UpdateBooksCustom: { - /** Returns exactly 1 result. Returns `Error` (with an optionally provided `errorMessage`) if more or less than exactly 1 result is returned. */ - expectOne: (_1:PgTyped_Pg_Client_t, _2:updateBooksCustomParams, errorMessage:(undefined | string)) => Promise< - { - TAG: "Ok"; - _0: updateBooksCustomResult - } - | { - TAG: "Error"; - _0: string - }>; + /** Returns exactly 1 result. Raises `Exn.t` (with an optionally provided `errorMessage`) if more or less than exactly 1 result is returned. */ + expectOne: (_1:PgTyped_Pg_Client_t, _2:updateBooksCustomParams, errorMessage:(undefined | string)) => Promise; /** Returns exactly 1 result. Returns `None` if more or less than exactly 1 result is returned. */ one: (_1:PgTyped_Pg_Client_t, _2:updateBooksCustomParams) => Promise<(undefined | updateBooksCustomResult)>; /** Returns an array of all matched results. */ @@ -836,16 +728,8 @@ export const UpdateBooksCustom: { } = books__sqlJS.UpdateBooksCustom as any; export const InsertBooks: { - /** Returns exactly 1 result. Returns `Error` (with an optionally provided `errorMessage`) if more or less than exactly 1 result is returned. */ - expectOne: (_1:PgTyped_Pg_Client_t, _2:insertBooksParams, errorMessage:(undefined | string)) => Promise< - { - TAG: "Ok"; - _0: insertBooksResult - } - | { - TAG: "Error"; - _0: string - }>; + /** Returns exactly 1 result. Raises `Exn.t` (with an optionally provided `errorMessage`) if more or less than exactly 1 result is returned. */ + expectOne: (_1:PgTyped_Pg_Client_t, _2:insertBooksParams, errorMessage:(undefined | string)) => Promise; /** Returns exactly 1 result. Returns `None` if more or less than exactly 1 result is returned. */ one: (_1:PgTyped_Pg_Client_t, _2:insertBooksParams) => Promise<(undefined | insertBooksResult)>; /** Returns an array of all matched results. */ @@ -855,16 +739,8 @@ export const InsertBooks: { } = books__sqlJS.InsertBooks as any; export const UpdateBooksRankNotNull: { - /** Returns exactly 1 result. Returns `Error` (with an optionally provided `errorMessage`) if more or less than exactly 1 result is returned. */ - expectOne: (_1:PgTyped_Pg_Client_t, _2:updateBooksRankNotNullParams, errorMessage:(undefined | string)) => Promise< - { - TAG: "Ok"; - _0: updateBooksRankNotNullResult - } - | { - TAG: "Error"; - _0: string - }>; + /** Returns exactly 1 result. Raises `Exn.t` (with an optionally provided `errorMessage`) if more or less than exactly 1 result is returned. */ + expectOne: (_1:PgTyped_Pg_Client_t, _2:updateBooksRankNotNullParams, errorMessage:(undefined | string)) => Promise; /** Returns exactly 1 result. Returns `None` if more or less than exactly 1 result is returned. */ one: (_1:PgTyped_Pg_Client_t, _2:updateBooksRankNotNullParams) => Promise<(undefined | updateBooksRankNotNullResult)>; /** Returns an array of all matched results. */ @@ -874,16 +750,8 @@ export const UpdateBooksRankNotNull: { } = books__sqlJS.UpdateBooksRankNotNull as any; export const GetBookCountries: { - /** Returns exactly 1 result. Returns `Error` (with an optionally provided `errorMessage`) if more or less than exactly 1 result is returned. */ - expectOne: (_1:PgTyped_Pg_Client_t, _2:getBookCountriesParams, errorMessage:(undefined | string)) => Promise< - { - TAG: "Ok"; - _0: getBookCountriesResult - } - | { - TAG: "Error"; - _0: string - }>; + /** Returns exactly 1 result. Raises `Exn.t` (with an optionally provided `errorMessage`) if more or less than exactly 1 result is returned. */ + expectOne: (_1:PgTyped_Pg_Client_t, _2:getBookCountriesParams, errorMessage:(undefined | string)) => Promise; /** Returns exactly 1 result. Returns `None` if more or less than exactly 1 result is returned. */ one: (_1:PgTyped_Pg_Client_t, _2:getBookCountriesParams) => Promise<(undefined | getBookCountriesResult)>; /** Returns an array of all matched results. */ @@ -893,16 +761,8 @@ export const GetBookCountries: { } = books__sqlJS.GetBookCountries as any; export const FindBookUnicode: { - /** Returns exactly 1 result. Returns `Error` (with an optionally provided `errorMessage`) if more or less than exactly 1 result is returned. */ - expectOne: (_1:PgTyped_Pg_Client_t, _2:findBookUnicodeParams, errorMessage:(undefined | string)) => Promise< - { - TAG: "Ok"; - _0: findBookUnicodeResult - } - | { - TAG: "Error"; - _0: string - }>; + /** Returns exactly 1 result. Raises `Exn.t` (with an optionally provided `errorMessage`) if more or less than exactly 1 result is returned. */ + expectOne: (_1:PgTyped_Pg_Client_t, _2:findBookUnicodeParams, errorMessage:(undefined | string)) => Promise; /** Returns exactly 1 result. Returns `None` if more or less than exactly 1 result is returned. */ one: (_1:PgTyped_Pg_Client_t, _2:findBookUnicodeParams) => Promise<(undefined | findBookUnicodeResult)>; /** Returns an array of all matched results. */ diff --git a/packages/example/src/comments/comments__sql.gen.tsx b/packages/example/src/comments/comments__sql.gen.tsx index 0b20c64e..4f7ad44a 100644 --- a/packages/example/src/comments/comments__sql.gen.tsx +++ b/packages/example/src/comments/comments__sql.gen.tsx @@ -66,10 +66,8 @@ export const GetAllComments_many: (_1:PgTyped_Pg_Client_t, _2:getAllCommentsPara /** Returns exactly 1 result. Returns `None` if more or less than exactly 1 result is returned. */ export const GetAllComments_one: (_1:PgTyped_Pg_Client_t, _2:getAllCommentsParams) => Promise<(undefined | getAllCommentsResult)> = comments__sqlJS.GetAllComments.one as any; -/** Returns exactly 1 result. Returns `Error` (with an optionally provided `errorMessage`) if more or less than exactly 1 result is returned. */ -export const GetAllComments_expectOne: (_1:PgTyped_Pg_Client_t, _2:getAllCommentsParams, errorMessage:(undefined | string)) => Promise< - { TAG: "Ok"; _0: getAllCommentsResult } - | { TAG: "Error"; _0: string }> = comments__sqlJS.GetAllComments.expectOne as any; +/** Returns exactly 1 result. Raises `Exn.t` (with an optionally provided `errorMessage`) if more or less than exactly 1 result is returned. */ +export const GetAllComments_expectOne: (_1:PgTyped_Pg_Client_t, _2:getAllCommentsParams, errorMessage:(undefined | string)) => Promise = comments__sqlJS.GetAllComments.expectOne as any; /** Executes the query, but ignores whatever is returned by it. */ export const GetAllComments_execute: (_1:PgTyped_Pg_Client_t, _2:getAllCommentsParams) => Promise = comments__sqlJS.GetAllComments.execute as any; @@ -82,10 +80,8 @@ export const GetAllCommentsByIds_many: (_1:PgTyped_Pg_Client_t, _2:getAllComment /** Returns exactly 1 result. Returns `None` if more or less than exactly 1 result is returned. */ export const GetAllCommentsByIds_one: (_1:PgTyped_Pg_Client_t, _2:getAllCommentsByIdsParams) => Promise<(undefined | getAllCommentsByIdsResult)> = comments__sqlJS.GetAllCommentsByIds.one as any; -/** Returns exactly 1 result. Returns `Error` (with an optionally provided `errorMessage`) if more or less than exactly 1 result is returned. */ -export const GetAllCommentsByIds_expectOne: (_1:PgTyped_Pg_Client_t, _2:getAllCommentsByIdsParams, errorMessage:(undefined | string)) => Promise< - { TAG: "Ok"; _0: getAllCommentsByIdsResult } - | { TAG: "Error"; _0: string }> = comments__sqlJS.GetAllCommentsByIds.expectOne as any; +/** Returns exactly 1 result. Raises `Exn.t` (with an optionally provided `errorMessage`) if more or less than exactly 1 result is returned. */ +export const GetAllCommentsByIds_expectOne: (_1:PgTyped_Pg_Client_t, _2:getAllCommentsByIdsParams, errorMessage:(undefined | string)) => Promise = comments__sqlJS.GetAllCommentsByIds.expectOne as any; /** Executes the query, but ignores whatever is returned by it. */ export const GetAllCommentsByIds_execute: (_1:PgTyped_Pg_Client_t, _2:getAllCommentsByIdsParams) => Promise = comments__sqlJS.GetAllCommentsByIds.execute as any; @@ -98,10 +94,8 @@ export const InsertComment_many: (_1:PgTyped_Pg_Client_t, _2:insertCommentParams /** Returns exactly 1 result. Returns `None` if more or less than exactly 1 result is returned. */ export const InsertComment_one: (_1:PgTyped_Pg_Client_t, _2:insertCommentParams) => Promise<(undefined | insertCommentResult)> = comments__sqlJS.InsertComment.one as any; -/** Returns exactly 1 result. Returns `Error` (with an optionally provided `errorMessage`) if more or less than exactly 1 result is returned. */ -export const InsertComment_expectOne: (_1:PgTyped_Pg_Client_t, _2:insertCommentParams, errorMessage:(undefined | string)) => Promise< - { TAG: "Ok"; _0: insertCommentResult } - | { TAG: "Error"; _0: string }> = comments__sqlJS.InsertComment.expectOne as any; +/** Returns exactly 1 result. Raises `Exn.t` (with an optionally provided `errorMessage`) if more or less than exactly 1 result is returned. */ +export const InsertComment_expectOne: (_1:PgTyped_Pg_Client_t, _2:insertCommentParams, errorMessage:(undefined | string)) => Promise = comments__sqlJS.InsertComment.expectOne as any; /** Executes the query, but ignores whatever is returned by it. */ export const InsertComment_execute: (_1:PgTyped_Pg_Client_t, _2:insertCommentParams) => Promise = comments__sqlJS.InsertComment.execute as any; @@ -114,10 +108,8 @@ export const SelectExistsTest_many: (_1:PgTyped_Pg_Client_t, _2:selectExistsTest /** Returns exactly 1 result. Returns `None` if more or less than exactly 1 result is returned. */ export const SelectExistsTest_one: (_1:PgTyped_Pg_Client_t, _2:selectExistsTestParams) => Promise<(undefined | selectExistsTestResult)> = comments__sqlJS.SelectExistsTest.one as any; -/** Returns exactly 1 result. Returns `Error` (with an optionally provided `errorMessage`) if more or less than exactly 1 result is returned. */ -export const SelectExistsTest_expectOne: (_1:PgTyped_Pg_Client_t, _2:selectExistsTestParams, errorMessage:(undefined | string)) => Promise< - { TAG: "Ok"; _0: selectExistsTestResult } - | { TAG: "Error"; _0: string }> = comments__sqlJS.SelectExistsTest.expectOne as any; +/** Returns exactly 1 result. Raises `Exn.t` (with an optionally provided `errorMessage`) if more or less than exactly 1 result is returned. */ +export const SelectExistsTest_expectOne: (_1:PgTyped_Pg_Client_t, _2:selectExistsTestParams, errorMessage:(undefined | string)) => Promise = comments__sqlJS.SelectExistsTest.expectOne as any; /** Executes the query, but ignores whatever is returned by it. */ export const SelectExistsTest_execute: (_1:PgTyped_Pg_Client_t, _2:selectExistsTestParams) => Promise = comments__sqlJS.SelectExistsTest.execute as any; @@ -125,16 +117,8 @@ export const SelectExistsTest_execute: (_1:PgTyped_Pg_Client_t, _2:selectExistsT export const selectExistsTest: (params:selectExistsTestParams, client:PgTyped_Pg_Client_t) => Promise = comments__sqlJS.selectExistsTest as any; export const SelectExistsTest: { - /** Returns exactly 1 result. Returns `Error` (with an optionally provided `errorMessage`) if more or less than exactly 1 result is returned. */ - expectOne: (_1:PgTyped_Pg_Client_t, _2:selectExistsTestParams, errorMessage:(undefined | string)) => Promise< - { - TAG: "Ok"; - _0: selectExistsTestResult - } - | { - TAG: "Error"; - _0: string - }>; + /** Returns exactly 1 result. Raises `Exn.t` (with an optionally provided `errorMessage`) if more or less than exactly 1 result is returned. */ + expectOne: (_1:PgTyped_Pg_Client_t, _2:selectExistsTestParams, errorMessage:(undefined | string)) => Promise; /** Returns exactly 1 result. Returns `None` if more or less than exactly 1 result is returned. */ one: (_1:PgTyped_Pg_Client_t, _2:selectExistsTestParams) => Promise<(undefined | selectExistsTestResult)>; /** Returns an array of all matched results. */ @@ -144,16 +128,8 @@ export const SelectExistsTest: { } = comments__sqlJS.SelectExistsTest as any; export const GetAllComments: { - /** Returns exactly 1 result. Returns `Error` (with an optionally provided `errorMessage`) if more or less than exactly 1 result is returned. */ - expectOne: (_1:PgTyped_Pg_Client_t, _2:getAllCommentsParams, errorMessage:(undefined | string)) => Promise< - { - TAG: "Ok"; - _0: getAllCommentsResult - } - | { - TAG: "Error"; - _0: string - }>; + /** Returns exactly 1 result. Raises `Exn.t` (with an optionally provided `errorMessage`) if more or less than exactly 1 result is returned. */ + expectOne: (_1:PgTyped_Pg_Client_t, _2:getAllCommentsParams, errorMessage:(undefined | string)) => Promise; /** Returns exactly 1 result. Returns `None` if more or less than exactly 1 result is returned. */ one: (_1:PgTyped_Pg_Client_t, _2:getAllCommentsParams) => Promise<(undefined | getAllCommentsResult)>; /** Returns an array of all matched results. */ @@ -163,16 +139,8 @@ export const GetAllComments: { } = comments__sqlJS.GetAllComments as any; export const GetAllCommentsByIds: { - /** Returns exactly 1 result. Returns `Error` (with an optionally provided `errorMessage`) if more or less than exactly 1 result is returned. */ - expectOne: (_1:PgTyped_Pg_Client_t, _2:getAllCommentsByIdsParams, errorMessage:(undefined | string)) => Promise< - { - TAG: "Ok"; - _0: getAllCommentsByIdsResult - } - | { - TAG: "Error"; - _0: string - }>; + /** Returns exactly 1 result. Raises `Exn.t` (with an optionally provided `errorMessage`) if more or less than exactly 1 result is returned. */ + expectOne: (_1:PgTyped_Pg_Client_t, _2:getAllCommentsByIdsParams, errorMessage:(undefined | string)) => Promise; /** Returns exactly 1 result. Returns `None` if more or less than exactly 1 result is returned. */ one: (_1:PgTyped_Pg_Client_t, _2:getAllCommentsByIdsParams) => Promise<(undefined | getAllCommentsByIdsResult)>; /** Returns an array of all matched results. */ @@ -182,16 +150,8 @@ export const GetAllCommentsByIds: { } = comments__sqlJS.GetAllCommentsByIds as any; export const InsertComment: { - /** Returns exactly 1 result. Returns `Error` (with an optionally provided `errorMessage`) if more or less than exactly 1 result is returned. */ - expectOne: (_1:PgTyped_Pg_Client_t, _2:insertCommentParams, errorMessage:(undefined | string)) => Promise< - { - TAG: "Ok"; - _0: insertCommentResult - } - | { - TAG: "Error"; - _0: string - }>; + /** Returns exactly 1 result. Raises `Exn.t` (with an optionally provided `errorMessage`) if more or less than exactly 1 result is returned. */ + expectOne: (_1:PgTyped_Pg_Client_t, _2:insertCommentParams, errorMessage:(undefined | string)) => Promise; /** Returns exactly 1 result. Returns `None` if more or less than exactly 1 result is returned. */ one: (_1:PgTyped_Pg_Client_t, _2:insertCommentParams) => Promise<(undefined | insertCommentResult)>; /** Returns an array of all matched results. */ diff --git a/packages/example/src/notifications/notifications__sql.gen.tsx b/packages/example/src/notifications/notifications__sql.gen.tsx index c01e8ce5..26c1d130 100644 --- a/packages/example/src/notifications/notifications__sql.gen.tsx +++ b/packages/example/src/notifications/notifications__sql.gen.tsx @@ -62,10 +62,8 @@ export const SendNotifications_many: (_1:PgTyped_Pg_Client_t, _2:sendNotificatio /** Returns exactly 1 result. Returns `None` if more or less than exactly 1 result is returned. */ export const SendNotifications_one: (_1:PgTyped_Pg_Client_t, _2:sendNotificationsParams) => Promise<(undefined | sendNotificationsResult)> = notifications__sqlJS.SendNotifications.one as any; -/** Returns exactly 1 result. Returns `Error` (with an optionally provided `errorMessage`) if more or less than exactly 1 result is returned. */ -export const SendNotifications_expectOne: (_1:PgTyped_Pg_Client_t, _2:sendNotificationsParams, errorMessage:(undefined | string)) => Promise< - { TAG: "Ok"; _0: sendNotificationsResult } - | { TAG: "Error"; _0: string }> = notifications__sqlJS.SendNotifications.expectOne as any; +/** Returns exactly 1 result. Raises `Exn.t` (with an optionally provided `errorMessage`) if more or less than exactly 1 result is returned. */ +export const SendNotifications_expectOne: (_1:PgTyped_Pg_Client_t, _2:sendNotificationsParams, errorMessage:(undefined | string)) => Promise = notifications__sqlJS.SendNotifications.expectOne as any; /** Executes the query, but ignores whatever is returned by it. */ export const SendNotifications_execute: (_1:PgTyped_Pg_Client_t, _2:sendNotificationsParams) => Promise = notifications__sqlJS.SendNotifications.execute as any; @@ -78,10 +76,8 @@ export const GetNotifications_many: (_1:PgTyped_Pg_Client_t, _2:getNotifications /** Returns exactly 1 result. Returns `None` if more or less than exactly 1 result is returned. */ export const GetNotifications_one: (_1:PgTyped_Pg_Client_t, _2:getNotificationsParams) => Promise<(undefined | getNotificationsResult)> = notifications__sqlJS.GetNotifications.one as any; -/** Returns exactly 1 result. Returns `Error` (with an optionally provided `errorMessage`) if more or less than exactly 1 result is returned. */ -export const GetNotifications_expectOne: (_1:PgTyped_Pg_Client_t, _2:getNotificationsParams, errorMessage:(undefined | string)) => Promise< - { TAG: "Ok"; _0: getNotificationsResult } - | { TAG: "Error"; _0: string }> = notifications__sqlJS.GetNotifications.expectOne as any; +/** Returns exactly 1 result. Raises `Exn.t` (with an optionally provided `errorMessage`) if more or less than exactly 1 result is returned. */ +export const GetNotifications_expectOne: (_1:PgTyped_Pg_Client_t, _2:getNotificationsParams, errorMessage:(undefined | string)) => Promise = notifications__sqlJS.GetNotifications.expectOne as any; /** Executes the query, but ignores whatever is returned by it. */ export const GetNotifications_execute: (_1:PgTyped_Pg_Client_t, _2:getNotificationsParams) => Promise = notifications__sqlJS.GetNotifications.execute as any; @@ -94,10 +90,8 @@ export const ThresholdFrogs_many: (_1:PgTyped_Pg_Client_t, _2:thresholdFrogsPara /** Returns exactly 1 result. Returns `None` if more or less than exactly 1 result is returned. */ export const ThresholdFrogs_one: (_1:PgTyped_Pg_Client_t, _2:thresholdFrogsParams) => Promise<(undefined | thresholdFrogsResult)> = notifications__sqlJS.ThresholdFrogs.one as any; -/** Returns exactly 1 result. Returns `Error` (with an optionally provided `errorMessage`) if more or less than exactly 1 result is returned. */ -export const ThresholdFrogs_expectOne: (_1:PgTyped_Pg_Client_t, _2:thresholdFrogsParams, errorMessage:(undefined | string)) => Promise< - { TAG: "Ok"; _0: thresholdFrogsResult } - | { TAG: "Error"; _0: string }> = notifications__sqlJS.ThresholdFrogs.expectOne as any; +/** Returns exactly 1 result. Raises `Exn.t` (with an optionally provided `errorMessage`) if more or less than exactly 1 result is returned. */ +export const ThresholdFrogs_expectOne: (_1:PgTyped_Pg_Client_t, _2:thresholdFrogsParams, errorMessage:(undefined | string)) => Promise = notifications__sqlJS.ThresholdFrogs.expectOne as any; /** Executes the query, but ignores whatever is returned by it. */ export const ThresholdFrogs_execute: (_1:PgTyped_Pg_Client_t, _2:thresholdFrogsParams) => Promise = notifications__sqlJS.ThresholdFrogs.execute as any; @@ -105,16 +99,8 @@ export const ThresholdFrogs_execute: (_1:PgTyped_Pg_Client_t, _2:thresholdFrogsP export const thresholdFrogs: (params:thresholdFrogsParams, client:PgTyped_Pg_Client_t) => Promise = notifications__sqlJS.thresholdFrogs as any; export const ThresholdFrogs: { - /** Returns exactly 1 result. Returns `Error` (with an optionally provided `errorMessage`) if more or less than exactly 1 result is returned. */ - expectOne: (_1:PgTyped_Pg_Client_t, _2:thresholdFrogsParams, errorMessage:(undefined | string)) => Promise< - { - TAG: "Ok"; - _0: thresholdFrogsResult - } - | { - TAG: "Error"; - _0: string - }>; + /** Returns exactly 1 result. Raises `Exn.t` (with an optionally provided `errorMessage`) if more or less than exactly 1 result is returned. */ + expectOne: (_1:PgTyped_Pg_Client_t, _2:thresholdFrogsParams, errorMessage:(undefined | string)) => Promise; /** Returns exactly 1 result. Returns `None` if more or less than exactly 1 result is returned. */ one: (_1:PgTyped_Pg_Client_t, _2:thresholdFrogsParams) => Promise<(undefined | thresholdFrogsResult)>; /** Returns an array of all matched results. */ @@ -124,16 +110,8 @@ export const ThresholdFrogs: { } = notifications__sqlJS.ThresholdFrogs as any; export const SendNotifications: { - /** Returns exactly 1 result. Returns `Error` (with an optionally provided `errorMessage`) if more or less than exactly 1 result is returned. */ - expectOne: (_1:PgTyped_Pg_Client_t, _2:sendNotificationsParams, errorMessage:(undefined | string)) => Promise< - { - TAG: "Ok"; - _0: sendNotificationsResult - } - | { - TAG: "Error"; - _0: string - }>; + /** Returns exactly 1 result. Raises `Exn.t` (with an optionally provided `errorMessage`) if more or less than exactly 1 result is returned. */ + expectOne: (_1:PgTyped_Pg_Client_t, _2:sendNotificationsParams, errorMessage:(undefined | string)) => Promise; /** Returns exactly 1 result. Returns `None` if more or less than exactly 1 result is returned. */ one: (_1:PgTyped_Pg_Client_t, _2:sendNotificationsParams) => Promise<(undefined | sendNotificationsResult)>; /** Returns an array of all matched results. */ @@ -143,16 +121,8 @@ export const SendNotifications: { } = notifications__sqlJS.SendNotifications as any; export const GetNotifications: { - /** Returns exactly 1 result. Returns `Error` (with an optionally provided `errorMessage`) if more or less than exactly 1 result is returned. */ - expectOne: (_1:PgTyped_Pg_Client_t, _2:getNotificationsParams, errorMessage:(undefined | string)) => Promise< - { - TAG: "Ok"; - _0: getNotificationsResult - } - | { - TAG: "Error"; - _0: string - }>; + /** Returns exactly 1 result. Raises `Exn.t` (with an optionally provided `errorMessage`) if more or less than exactly 1 result is returned. */ + expectOne: (_1:PgTyped_Pg_Client_t, _2:getNotificationsParams, errorMessage:(undefined | string)) => Promise; /** Returns exactly 1 result. Returns `None` if more or less than exactly 1 result is returned. */ one: (_1:PgTyped_Pg_Client_t, _2:getNotificationsParams) => Promise<(undefined | getNotificationsResult)>; /** Returns an array of all matched results. */ diff --git a/packages/example/src/rescript.test.res b/packages/example/src/rescript.test.res index 0ab835ac..6d55a218 100644 --- a/packages/example/src/rescript.test.res +++ b/packages/example/src/rescript.test.res @@ -247,13 +247,18 @@ testAsync("`one` works in fail case", async () => { expect(result->Option.isSome)->Expect.toBe(false) }) -testAsync("`expectOne` works in success case", async () => { - let result = await getClient()->Books.GetBooksByAuthorName.expectOne({authorName: "Carl Sagan"}) - expect(result->Result.isOk)->Expect.toBe(true) +testAsync("`expectOne` works", async () => { + let _result = await getClient()->Books.GetBooksByAuthorName.expectOne({authorName: "Carl Sagan"}) + expect(true)->Expect.toBe(true) }) testAsync("`expectOne` works in fail case", async () => { - let result = - await getClient()->Books.GetBooksByAuthorName.expectOne({authorName: "Bertolt Brecht"}) - expect(result->Result.isError)->Expect.toBe(true) + let result = switch await getClient()->Books.GetBooksByAuthorName.expectOne({ + authorName: "Bertolt Brecht", + }) { + | exception Exn.Error(_) => true + | _ => false + } + + expect(result)->Expect.toBe(true) })