@@ -20,17 +20,17 @@ type IllRepo interface {
2020 GetIllTransactionByRequesterRequestIdForUpdate (ctx extctx.ExtendedContext , requesterRequestID pgtype.Text ) (IllTransaction , error )
2121 GetIllTransactionById (ctx extctx.ExtendedContext , id string ) (IllTransaction , error )
2222 GetIllTransactionByIdForUpdate (ctx extctx.ExtendedContext , id string ) (IllTransaction , error )
23- ListIllTransactions (ctx extctx.ExtendedContext ) ([]IllTransaction , error )
23+ ListIllTransactions (ctx extctx.ExtendedContext , params ListIllTransactionsParams ) ([]IllTransaction , int64 , error )
24+ GetIllTransactionsByRequesterSymbol (ctx extctx.ExtendedContext , params GetIllTransactionsByRequesterSymbolParams ) ([]IllTransaction , int64 , error )
2425 DeleteIllTransaction (ctx extctx.ExtendedContext , id string ) error
2526 SavePeer (ctx extctx.ExtendedContext , params SavePeerParams ) (Peer , error )
2627 GetPeerById (ctx extctx.ExtendedContext , id string ) (Peer , error )
2728 GetPeerBySymbol (ctx extctx.ExtendedContext , symbol string ) (Peer , error )
28- ListPeers (ctx extctx.ExtendedContext ) ([]Peer , error )
29+ ListPeers (ctx extctx.ExtendedContext , params ListPeersParams ) ([]Peer , int64 , error )
2930 DeletePeer (ctx extctx.ExtendedContext , id string ) error
3031 SaveLocatedSupplier (ctx extctx.ExtendedContext , params SaveLocatedSupplierParams ) (LocatedSupplier , error )
3132 GetLocatedSupplierByIllTransactionAndStatus (ctx extctx.ExtendedContext , params GetLocatedSupplierByIllTransactionAndStatusParams ) ([]LocatedSupplier , error )
32- GetLocatedSupplierByIllTransition (ctx extctx.ExtendedContext , illTransactionID string ) ([]LocatedSupplier , error )
33- ListLocatedSuppliers (ctx extctx.ExtendedContext ) ([]LocatedSupplier , error )
33+ GetLocatedSupplierByIllTransaction (ctx extctx.ExtendedContext , params GetLocatedSupplierByIllTransactionParams ) ([]LocatedSupplier , int64 , error )
3434 GetLocatedSupplierByIllTransactionAndStatusForUpdate (ctx extctx.ExtendedContext , params GetLocatedSupplierByIllTransactionAndStatusForUpdateParams ) ([]LocatedSupplier , error )
3535 GetLocatedSupplierByIllTransactionAndSupplierForUpdate (ctx extctx.ExtendedContext , params GetLocatedSupplierByIllTransactionAndSupplierForUpdateParams ) (LocatedSupplier , error )
3636 GetSelectedSupplierForIllTransaction (ctx extctx.ExtendedContext , illTransId string ) (LocatedSupplier , error )
@@ -86,15 +86,40 @@ func (r *PgIllRepo) GetIllTransactionByIdForUpdate(ctx extctx.ExtendedContext, i
8686 return row .IllTransaction , err
8787}
8888
89- func (r * PgIllRepo ) ListIllTransactions (ctx extctx.ExtendedContext ) ([]IllTransaction , error ) {
90- rows , err := r .queries .ListIllTransactions (ctx , r .GetConnOrTx ())
89+ func (r * PgIllRepo ) ListIllTransactions (ctx extctx.ExtendedContext , params ListIllTransactionsParams ) ([]IllTransaction , int64 , error ) {
90+ rows , err := r .queries .ListIllTransactions (ctx , r .GetConnOrTx (), params )
9191 var transactions []IllTransaction
92+ var fullCount int64
93+ if err == nil {
94+ if len (rows ) > 0 {
95+ fullCount = rows [0 ].FullCount
96+ for _ , r := range rows {
97+ fullCount = r .FullCount
98+ transactions = append (transactions , r .IllTransaction )
99+ }
100+ } else {
101+ params .Limit = 1
102+ params .Offset = 0
103+ rows , err = r .queries .ListIllTransactions (ctx , r .GetConnOrTx (), params )
104+ if err == nil && len (rows ) > 0 {
105+ fullCount = rows [0 ].FullCount
106+ }
107+ }
108+ }
109+ return transactions , fullCount , err
110+ }
111+
112+ func (r * PgIllRepo ) GetIllTransactionsByRequesterSymbol (ctx extctx.ExtendedContext , params GetIllTransactionsByRequesterSymbolParams ) ([]IllTransaction , int64 , error ) {
113+ rows , err := r .queries .GetIllTransactionsByRequesterSymbol (ctx , r .GetConnOrTx (), params )
114+ var transactions []IllTransaction
115+ var fullCount int64
92116 if err == nil {
93117 for _ , r := range rows {
118+ fullCount = r .FullCount
94119 transactions = append (transactions , r .IllTransaction )
95120 }
96121 }
97- return transactions , err
122+ return transactions , fullCount , err
98123}
99124
100125func (r * PgIllRepo ) DeleteIllTransaction (ctx extctx.ExtendedContext , id string ) error {
@@ -111,15 +136,17 @@ func (r *PgIllRepo) GetPeerBySymbol(ctx extctx.ExtendedContext, symbol string) (
111136 return row .Peer , err
112137}
113138
114- func (r * PgIllRepo ) ListPeers (ctx extctx.ExtendedContext ) ([]Peer , error ) {
115- rows , err := r .queries .ListPeers (ctx , r .GetConnOrTx ())
139+ func (r * PgIllRepo ) ListPeers (ctx extctx.ExtendedContext , params ListPeersParams ) ([]Peer , int64 , error ) {
140+ rows , err := r .queries .ListPeers (ctx , r .GetConnOrTx (), params )
116141 var peers []Peer
142+ var fullCount int64
117143 if err == nil {
118144 for _ , r := range rows {
145+ fullCount = r .FullCount
119146 peers = append (peers , r .Peer )
120147 }
121148 }
122- return peers , err
149+ return peers , fullCount , err
123150}
124151
125152func (r * PgIllRepo ) GetLocatedSupplierByIllTransactionAndStatus (ctx extctx.ExtendedContext , params GetLocatedSupplierByIllTransactionAndStatusParams ) ([]LocatedSupplier , error ) {
@@ -163,25 +190,17 @@ func (r *PgIllRepo) GetLocatedSupplierByIllTransactionAndSupplierForUpdate(ctx e
163190 return row .LocatedSupplier , err
164191}
165192
166- func (r * PgIllRepo ) GetLocatedSupplierByIllTransition (ctx extctx.ExtendedContext , illTransactionID string ) ([]LocatedSupplier , error ) {
167- rows , err := r .queries .GetLocatedSupplierByIllTransition (ctx , r .GetConnOrTx (), illTransactionID )
193+ func (r * PgIllRepo ) GetLocatedSupplierByIllTransaction (ctx extctx.ExtendedContext , params GetLocatedSupplierByIllTransactionParams ) ([]LocatedSupplier , int64 , error ) {
194+ rows , err := r .queries .GetLocatedSupplierByIllTransaction (ctx , r .GetConnOrTx (), params )
168195 var suppliers []LocatedSupplier
196+ var fullCount int64
169197 if err == nil {
170198 for _ , r := range rows {
199+ fullCount = r .FullCount
171200 suppliers = append (suppliers , r .LocatedSupplier )
172201 }
173202 }
174- return suppliers , err
175- }
176- func (r * PgIllRepo ) ListLocatedSuppliers (ctx extctx.ExtendedContext ) ([]LocatedSupplier , error ) {
177- rows , err := r .queries .ListLocatedSuppliers (ctx , r .GetConnOrTx ())
178- var suppliers []LocatedSupplier
179- if err == nil {
180- for _ , r := range rows {
181- suppliers = append (suppliers , r .LocatedSupplier )
182- }
183- }
184- return suppliers , err
203+ return suppliers , fullCount , err
185204}
186205
187206func (r * PgIllRepo ) GetSelectedSupplierForIllTransaction (ctx extctx.ExtendedContext , illTransId string ) (LocatedSupplier , error ) {
0 commit comments