Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
canifa_note
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Vũ Hoàng Anh
canifa_note
Commits
f184d652
Unverified
Commit
f184d652
authored
Dec 21, 2023
by
Athurg Gooth
Committed by
GitHub
Dec 21, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: attachments send from telegram lost (#2650)
parent
b64e2ff6
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
8 additions
and
8 deletions
+8
-8
resource.go
store/db/mysql/resource.go
+3
-3
resource.go
store/db/postgres/resource.go
+2
-2
resource.go
store/db/sqlite/resource.go
+3
-3
No files found.
store/db/mysql/resource.go
View file @
f184d652
...
...
@@ -12,9 +12,9 @@ import (
)
func
(
d
*
DB
)
CreateResource
(
ctx
context
.
Context
,
create
*
store
.
Resource
)
(
*
store
.
Resource
,
error
)
{
fields
:=
[]
string
{
"`filename`"
,
"`blob`"
,
"`external_link`"
,
"`type`"
,
"`size`"
,
"`creator_id`"
,
"`internal_path`"
}
placeholder
:=
[]
string
{
"?"
,
"?"
,
"?"
,
"?"
,
"?"
,
"?"
,
"?"
}
args
:=
[]
any
{
create
.
Filename
,
create
.
Blob
,
create
.
ExternalLink
,
create
.
Type
,
create
.
Size
,
create
.
CreatorID
,
create
.
InternalPath
}
fields
:=
[]
string
{
"`filename`"
,
"`blob`"
,
"`external_link`"
,
"`type`"
,
"`size`"
,
"`creator_id`"
,
"`internal_path`"
,
"`memo_id`"
}
placeholder
:=
[]
string
{
"?"
,
"?"
,
"?"
,
"?"
,
"?"
,
"?"
,
"?"
,
"?"
}
args
:=
[]
any
{
create
.
Filename
,
create
.
Blob
,
create
.
ExternalLink
,
create
.
Type
,
create
.
Size
,
create
.
CreatorID
,
create
.
InternalPath
,
create
.
MemoID
}
stmt
:=
"INSERT INTO `resource` ("
+
strings
.
Join
(
fields
,
", "
)
+
") VALUES ("
+
strings
.
Join
(
placeholder
,
", "
)
+
")"
result
,
err
:=
d
.
db
.
ExecContext
(
ctx
,
stmt
,
args
...
)
...
...
store/db/postgres/resource.go
View file @
f184d652
...
...
@@ -13,8 +13,8 @@ import (
)
func
(
d
*
DB
)
CreateResource
(
ctx
context
.
Context
,
create
*
store
.
Resource
)
(
*
store
.
Resource
,
error
)
{
qb
:=
squirrel
.
Insert
(
"resource"
)
.
Columns
(
"filename"
,
"blob"
,
"external_link"
,
"type"
,
"size"
,
"creator_id"
,
"internal_path"
)
values
:=
[]
any
{
create
.
Filename
,
create
.
Blob
,
create
.
ExternalLink
,
create
.
Type
,
create
.
Size
,
create
.
CreatorID
,
create
.
InternalPath
}
qb
:=
squirrel
.
Insert
(
"resource"
)
.
Columns
(
"filename"
,
"blob"
,
"external_link"
,
"type"
,
"size"
,
"creator_id"
,
"internal_path"
,
"memo_id"
)
values
:=
[]
any
{
create
.
Filename
,
create
.
Blob
,
create
.
ExternalLink
,
create
.
Type
,
create
.
Size
,
create
.
CreatorID
,
create
.
InternalPath
,
create
.
MemoID
}
qb
=
qb
.
Values
(
values
...
)
.
Suffix
(
"RETURNING id"
)
query
,
args
,
err
:=
qb
.
PlaceholderFormat
(
squirrel
.
Dollar
)
.
ToSql
()
...
...
store/db/sqlite/resource.go
View file @
f184d652
...
...
@@ -10,9 +10,9 @@ import (
)
func
(
d
*
DB
)
CreateResource
(
ctx
context
.
Context
,
create
*
store
.
Resource
)
(
*
store
.
Resource
,
error
)
{
fields
:=
[]
string
{
"`filename`"
,
"`blob`"
,
"`external_link`"
,
"`type`"
,
"`size`"
,
"`creator_id`"
,
"`internal_path`"
}
placeholder
:=
[]
string
{
"?"
,
"?"
,
"?"
,
"?"
,
"?"
,
"?"
,
"?"
}
args
:=
[]
any
{
create
.
Filename
,
create
.
Blob
,
create
.
ExternalLink
,
create
.
Type
,
create
.
Size
,
create
.
CreatorID
,
create
.
InternalPath
}
fields
:=
[]
string
{
"`filename`"
,
"`blob`"
,
"`external_link`"
,
"`type`"
,
"`size`"
,
"`creator_id`"
,
"`internal_path`"
,
"`memo_id`"
}
placeholder
:=
[]
string
{
"?"
,
"?"
,
"?"
,
"?"
,
"?"
,
"?"
,
"?"
,
"?"
}
args
:=
[]
any
{
create
.
Filename
,
create
.
Blob
,
create
.
ExternalLink
,
create
.
Type
,
create
.
Size
,
create
.
CreatorID
,
create
.
InternalPath
,
create
.
MemoID
}
stmt
:=
"INSERT INTO `resource` ("
+
strings
.
Join
(
fields
,
", "
)
+
") VALUES ("
+
strings
.
Join
(
placeholder
,
", "
)
+
") RETURNING `id`, `created_ts`, `updated_ts`"
if
err
:=
d
.
db
.
QueryRowContext
(
ctx
,
stmt
,
args
...
)
.
Scan
(
&
create
.
ID
,
&
create
.
CreatedTs
,
&
create
.
UpdatedTs
);
err
!=
nil
{
...
...
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