Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
NPM Packages
js-db
Commits
001cfb62
Commit
001cfb62
authored
May 02, 2019
by
Milan Wikarski
🎪
Browse files
Added OFFSET option to select
parent
d6c99134
Pipeline
#24
canceled with stages
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
index.js
View file @
001cfb62
...
...
@@ -74,6 +74,14 @@ class DB {
return
''
;
}
_getOffset
(
offset
)
{
if
(
!
isNaN
(
Number
(
offset
))
&&
offset
!=
null
)
{
return
"
OFFSET
"
+
offset
;
}
return
""
;
}
_getReturning
(
returning
)
{
if
(
typeof
returning
===
'
string
'
)
{
return
` RETURNING
${
returning
}
`
;
...
...
@@ -106,7 +114,7 @@ class DB {
);
}
select
(
tableName
,
columns
=
'
*
'
,
where
=
null
,
limit
=
null
)
{
select
(
tableName
,
columns
=
'
*
'
,
where
=
null
,
limit
=
null
,
offset
=
null
)
{
let
q
;
if
(
typeof
columns
===
'
string
'
)
{
...
...
@@ -124,6 +132,7 @@ class DB {
q
+=
this
.
_getWhere
(
where
);
q
+=
this
.
_getLimit
(
limit
);
q
+=
this
.
_getOffset
(
offset
);
return
this
.
_sendResponse
(
q
);
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment