Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
N
Neos
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
1
Issues
1
List
Boards
Labels
Service Desk
Milestones
Merge Requests
4
Merge Requests
4
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
MyCard
Neos
Commits
7b6edba2
Commit
7b6edba2
authored
Jan 22, 2023
by
Chunchi Che
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update sqlite middleware
parent
c37bc844
Pipeline
#19734
passed with stages
in 5 minutes and 38 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
3 deletions
+22
-3
src/api/cards.ts
src/api/cards.ts
+1
-1
src/middleware/sqlite.ts
src/middleware/sqlite.ts
+21
-2
No files found.
src/api/cards.ts
View file @
7b6edba2
...
...
@@ -5,7 +5,7 @@ export interface CardMeta {
data
:
{
ot
?:
number
;
setcode
?:
number
;
type
_
?:
number
;
type
?:
number
;
atk
?:
number
;
def
?:
number
;
level
?:
number
;
...
...
src/middleware/sqlite.ts
View file @
7b6edba2
...
...
@@ -6,6 +6,7 @@
* */
import
initSqlJs
,
{
Database
}
from
"
sql.js
"
;
import
{
CardMeta
}
from
"
../api/cards
"
;
export
enum
sqliteCmd
{
// 初始化
...
...
@@ -44,8 +45,14 @@ export default async function (action: sqliteAction) {
break
;
}
case
sqliteCmd
.
SELECT
:
{
if
(
YGODB
)
{
// TDOO
if
(
YGODB
&&
action
.
payload
)
{
const
code
=
action
.
payload
;
const
dataStmt
=
YGODB
.
prepare
(
"
SELECT * from datas WHERE ID = $id
"
);
const
dataResult
=
dataStmt
.
getAsObject
({
$id
:
code
});
const
textStmt
=
YGODB
.
prepare
(
"
SELECT * from texts WHERE ID = $id
"
);
const
textResult
=
textStmt
.
getAsObject
({
$id
:
code
});
return
constructCardMeta
(
code
,
dataResult
,
textResult
);
}
else
{
console
.
warn
(
"
ygo db not init!
"
);
}
...
...
@@ -59,3 +66,15 @@ export default async function (action: sqliteAction) {
}
}
}
function
constructCardMeta
(
id
:
number
,
data
:
initSqlJs
.
ParamsObject
,
text
:
initSqlJs
.
ParamsObject
):
CardMeta
{
return
{
id
,
data
,
text
,
};
}
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