FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
frontend/admin/app/dfp/Reader.scala at team-values · devhttps/frontend · GitHub
devhttps
/
frontend
Public
forked from
guardian/frontend
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Pull requests
0
Actions
Projects
Wiki
Security and quality
0
Insights
Additional navigation options
Code
Pull requests
Actions
Projects
Wiki
Security and quality
Insights
Expand file tree
Breadcrumbs
frontend
/
admin
/
app
/
dfp
/
Reader.scala
Copy path
More file actions
More file actions
Latest commit
History
History
History
28 lines (22 loc) · 849 Bytes
Breadcrumbs
frontend
/
admin
/
app
/
dfp
/
Reader.scala
Copy path
File metadata and controls
28 lines (22 loc) · 849 Bytes
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
package
dfp
import
com
.
google
.
api
.
ads
.
dfp
.
axis
.
utils
.
v201802
.
StatementBuilder
import
com
.
google
.
api
.
ads
.
dfp
.
axis
.
utils
.
v201802
.
StatementBuilder
.
SUGGESTED_PAGE_LIMIT
import
com
.
google
.
api
.
ads
.
dfp
.
axis
.
v201802
.
_
import
scala
.
annotation
.
tailrec
object
Reader
{
def
read
[
T
](
statementBuilder
:
StatementBuilder
)(
readPage
:
Statement
=>
(
Array
[
T
],
Int
))
:
Seq
[
T
]
=
{
@
tailrec
def
read
(
soFar
:
Seq
[
T
])
:
Seq
[
T
]
=
{
val
(pageOfResults, totalResultSetSize)
=
readPage(statementBuilder.toStatement)
val
resultsSoFar
=
Option
(pageOfResults).map(soFar
++
_).getOrElse(soFar)
if
(resultsSoFar.size
>=
totalResultSetSize) {
resultsSoFar
}
else
{
statementBuilder.increaseOffsetBy(
SUGGESTED_PAGE_LIMIT
)
read(resultsSoFar)
}
}
statementBuilder.limit(
SUGGESTED_PAGE_LIMIT
)
read(
Nil
)
}
}
Back
|
FazBrowse Home
|
New Git URL