Skip to content

Commit d0d4c18

Browse files
authored
update (#28)
1 parent 12561a7 commit d0d4c18

File tree

8 files changed

+24
-2
lines changed

8 files changed

+24
-2
lines changed

templates/query.tmpl

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,9 @@ let {{.MethodName}} (db: NpgsqlConnection) {{if .Arg.Pair}} ({{.Arg.Pair}}) {{-
5454
db
5555
|> Sql.existingConnection
5656
|> Sql.query {{.ConstantName}}
57+
{{ if .Arg.NpgsqlParams -}}
5758
|> Sql.parameters [ {{ .Arg.NpgsqlParams }} ]
59+
{{ end -}}
5860
|> Sql.executeRow{{if $.Options.EmitAsyncCode}}Async{{end}} reader
5961
{{end}}
6062

@@ -70,6 +72,9 @@ let {{.MethodName}} (db: NpgsqlConnection) {{if .Arg.Pair}} ({{.Arg.Pair}}) {{-
7072
db
7173
|> Sql.existingConnection
7274
|> Sql.query {{.ConstantName}}
75+
{{ if .Arg.NpgsqlParams -}}
76+
|> Sql.parameters [ {{ .Arg.NpgsqlParams }} ]
77+
{{ end -}}
7378
|> Sql.execute{{if $.Options.EmitAsyncCode}}Async{{end}} reader
7479
{{end}}
7580

@@ -80,7 +85,9 @@ let {{.MethodName}} (db: NpgsqlConnection) {{if .Arg.Pair}} ({{.Arg.Pair}}) {{-
8085
db
8186
|> Sql.existingConnection
8287
|> Sql.query {{.ConstantName}}
88+
{{ if .Arg.NpgsqlParams -}}
8389
|> Sql.parameters [ {{ .Arg.NpgsqlParams }} ]
90+
{{ end -}}
8491
|> Sql.executeNonQuery{{if $.Options.EmitAsyncCode}}Async{{end}}
8592
{{end}}
8693

@@ -91,7 +98,9 @@ let {{.MethodName}} (db: NpgsqlConnection) {{if .Arg.Pair}} ({{.Arg.Pair}}) {{-
9198
db
9299
|> Sql.existingConnection
93100
|> Sql.query {{.ConstantName}}
101+
{{ if .Arg.NpgsqlParams -}}
94102
|> Sql.parameters [ {{ .Arg.NpgsqlParams }} ]
103+
{{ end -}}
95104
|> Sql.executeNonQuery{{if $.Options.EmitAsyncCode }}Async{{end}}
96105
{{end}}
97106

@@ -102,7 +111,10 @@ let {{.MethodName}} (db: NpgsqlConnection) {{if .Arg.Pair}} ({{.Arg.Pair}}) {{-
102111
db
103112
|> Sql.existingConnection
104113
|> Sql.query {{.ConstantName}}
114+
{{ if .Arg.NpgsqlParams -}}
105115
|> Sql.parameters [ {{ .Arg.NpgsqlParams }} ]
116+
117+
{{ end -}}
106118
|> Sql.execute{{if $.Options.EmitAsyncCode}}Async{{end}}
107119
{{ end }}
108120

testdata/gen/auth_user.sql.fs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,6 @@ let GetTotalActiveUserCount (db: NpgsqlConnection) =
266266
db
267267
|> Sql.existingConnection
268268
|> Sql.query getTotalActiveUserCount
269-
|> Sql.parameters [ ]
270269
|> Sql.executeRow reader
271270

272271

@@ -381,6 +380,7 @@ let GetUserStats (db: NpgsqlConnection) (arg: GetUserStatsParams) =
381380
db
382381
|> Sql.existingConnection
383382
|> Sql.query getUserStats
383+
|> Sql.parameters [ "@limit", Sql.int arg.Limit; "@offset", Sql.int arg.Offset; "@default_rate_limit", Sql.int arg.DefaultRateLimit ]
384384
|> Sql.execute reader
385385

386386

@@ -422,6 +422,7 @@ let ListAuthUsers (db: NpgsqlConnection) (arg: ListAuthUsersParams) =
422422
db
423423
|> Sql.existingConnection
424424
|> Sql.query listAuthUsers
425+
|> Sql.parameters [ "@limit", Sql.int arg.Limit; "@offset", Sql.int arg.Offset ]
425426
|> Sql.execute reader
426427

427428

testdata/gen/chat_message.sql.fs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -397,6 +397,7 @@ let GetChatMessagesBySessionUUID (db: NpgsqlConnection) (arg: GetChatMessagesBy
397397
db
398398
|> Sql.existingConnection
399399
|> Sql.query getChatMessagesBySessionUUID
400+
|> Sql.parameters [ "@uuid", Sql.string arg.Uuid; "@offset", Sql.int arg.Offset; "@limit", Sql.int arg.Limit ]
400401
|> Sql.execute reader
401402

402403

@@ -583,6 +584,7 @@ let GetLastNChatMessages (db: NpgsqlConnection) (arg: GetLastNChatMessagesParam
583584
db
584585
|> Sql.existingConnection
585586
|> Sql.query getLastNChatMessages
587+
|> Sql.parameters [ "@uuid", Sql.string arg.Uuid; "@limit", Sql.int arg.Limit; "@chat_session_uuid", Sql.string arg.ChatSessionUuid ]
586588
|> Sql.execute reader
587589

588590

@@ -641,6 +643,7 @@ let GetLatestMessagesBySessionUUID (db: NpgsqlConnection) (arg: GetLatestMessag
641643
db
642644
|> Sql.existingConnection
643645
|> Sql.query getLatestMessagesBySessionUUID
646+
|> Sql.parameters [ "@chat_session_uuid", Sql.string arg.ChatSessionUuid; "@limit", Sql.int arg.Limit ]
644647
|> Sql.execute reader
645648

646649

testdata/gen/chat_model.sql.fs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,6 @@ let GetDefaultChatModel (db: NpgsqlConnection) =
236236
db
237237
|> Sql.existingConnection
238238
|> Sql.query getDefaultChatModel
239-
|> Sql.parameters [ ]
240239
|> Sql.executeRow reader
241240

242241

testdata/gen/chat_prompt.sql.fs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -306,6 +306,7 @@ let GetChatPromptsBySessionUUID (db: NpgsqlConnection) (chatSessionUuid: string
306306
db
307307
|> Sql.existingConnection
308308
|> Sql.query getChatPromptsBySessionUUID
309+
|> Sql.parameters [ "@chat_session_uuid", Sql.string chatSessionUuid ]
309310
|> Sql.execute reader
310311

311312

@@ -345,6 +346,7 @@ let GetChatPromptsByUserID (db: NpgsqlConnection) (userId: int32) =
345346
db
346347
|> Sql.existingConnection
347348
|> Sql.query getChatPromptsByUserID
349+
|> Sql.parameters [ "@user_id", Sql.int userId ]
348350
|> Sql.execute reader
349351

350352

@@ -384,6 +386,7 @@ let GetChatPromptsBysession_uuid (db: NpgsqlConnection) (chatSessionUuid: strin
384386
db
385387
|> Sql.existingConnection
386388
|> Sql.query getChatPromptsBysession_uuid
389+
|> Sql.parameters [ "@chat_session_uuid", Sql.string chatSessionUuid ]
387390
|> Sql.execute reader
388391

389392

testdata/gen/chat_session.sql.fs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -472,6 +472,7 @@ let GetChatSessionsByUserID (db: NpgsqlConnection) (userId: int32) =
472472
db
473473
|> Sql.existingConnection
474474
|> Sql.query getChatSessionsByUserID
475+
|> Sql.parameters [ "@user_id", Sql.int userId ]
475476
|> Sql.execute reader
476477

477478

testdata/gen/chat_snapshot.sql.fs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,7 @@ let ChatSnapshotMetaByUserID (db: NpgsqlConnection) (userId: int32) =
120120
db
121121
|> Sql.existingConnection
122122
|> Sql.query chatSnapshotMetaByUserID
123+
|> Sql.parameters [ "@user_id", Sql.int userId ]
123124
|> Sql.execute reader
124125

125126

@@ -159,6 +160,7 @@ let ChatSnapshotSearch (db: NpgsqlConnection) (arg: ChatSnapshotSearchParams) =
159160
db
160161
|> Sql.existingConnection
161162
|> Sql.query chatSnapshotSearch
163+
|> Sql.parameters [ "@user_id", Sql.int arg.UserId; "@search", Sql.string arg.Search ]
162164
|> Sql.execute reader
163165

164166

testdata/gen/chat_user_chat_model_privilege.sql.fs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,7 @@ let ListUserChatModelPrivilegesByUserID (db: NpgsqlConnection) (userId: int32)
208208
db
209209
|> Sql.existingConnection
210210
|> Sql.query listUserChatModelPrivilegesByUserID
211+
|> Sql.parameters [ "@user_id", Sql.int userId ]
211212
|> Sql.execute reader
212213

213214

0 commit comments

Comments
 (0)