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
977e7f55
Unverified
Commit
977e7f55
authored
Feb 27, 2023
by
boojack
Committed by
GitHub
Feb 27, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: add visibility field to resource (#1185)
parent
c399ff86
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
91 additions
and
53 deletions
+91
-53
resource.go
api/resource.go
+14
-11
s3.go
plugin/storage/s3/s3.go
+9
-7
profile.go
server/profile/profile.go
+4
-0
resource.go
server/resource.go
+8
-5
LATEST__SCHEMA.sql
store/db/migration/dev/LATEST__SCHEMA.sql
+2
-1
resource.go
store/resource.go
+54
-29
No files found.
api/resource.go
View file @
977e7f55
...
@@ -14,6 +14,7 @@ type Resource struct {
...
@@ -14,6 +14,7 @@ type Resource struct {
ExternalLink
string
`json:"externalLink"`
ExternalLink
string
`json:"externalLink"`
Type
string
`json:"type"`
Type
string
`json:"type"`
Size
int64
`json:"size"`
Size
int64
`json:"size"`
Visibility
Visibility
`json:"visibility"`
// Related fields
// Related fields
LinkedMemoAmount
int
`json:"linkedMemoAmount"`
LinkedMemoAmount
int
`json:"linkedMemoAmount"`
...
@@ -29,6 +30,7 @@ type ResourceCreate struct {
...
@@ -29,6 +30,7 @@ type ResourceCreate struct {
ExternalLink
string
`json:"externalLink"`
ExternalLink
string
`json:"externalLink"`
Type
string
`json:"type"`
Type
string
`json:"type"`
Size
int64
`json:"-"`
Size
int64
`json:"-"`
Visibility
Visibility
`json:"visibility"`
}
}
type
ResourceFind
struct
{
type
ResourceFind
struct
{
...
@@ -51,6 +53,7 @@ type ResourcePatch struct {
...
@@ -51,6 +53,7 @@ type ResourcePatch struct {
// Domain specific fields
// Domain specific fields
Filename
*
string
`json:"filename"`
Filename
*
string
`json:"filename"`
Visibility
*
Visibility
`json:"visibility"`
}
}
type
ResourceDelete
struct
{
type
ResourceDelete
struct
{
...
...
plugin/storage/s3/s3.go
View file @
977e7f55
...
@@ -35,7 +35,7 @@ func NewClient(ctx context.Context, config *Config) (*Client, error) {
...
@@ -35,7 +35,7 @@ func NewClient(ctx context.Context, config *Config) (*Client, error) {
},
nil
},
nil
})
})
cf
g
,
err
:=
s3config
.
LoadDefaultConfig
(
ctx
,
awsConfi
g
,
err
:=
s3config
.
LoadDefaultConfig
(
ctx
,
s3config
.
WithEndpointResolverWithOptions
(
resolver
),
s3config
.
WithEndpointResolverWithOptions
(
resolver
),
s3config
.
WithCredentialsProvider
(
credentials
.
NewStaticCredentialsProvider
(
config
.
AccessKey
,
config
.
SecretKey
,
""
)),
s3config
.
WithCredentialsProvider
(
credentials
.
NewStaticCredentialsProvider
(
config
.
AccessKey
,
config
.
SecretKey
,
""
)),
)
)
...
@@ -43,7 +43,7 @@ func NewClient(ctx context.Context, config *Config) (*Client, error) {
...
@@ -43,7 +43,7 @@ func NewClient(ctx context.Context, config *Config) (*Client, error) {
return
nil
,
err
return
nil
,
err
}
}
client
:=
awss3
.
NewFromConfig
(
cf
g
)
client
:=
awss3
.
NewFromConfig
(
awsConfi
g
)
return
&
Client
{
return
&
Client
{
Client
:
client
,
Client
:
client
,
...
@@ -53,7 +53,7 @@ func NewClient(ctx context.Context, config *Config) (*Client, error) {
...
@@ -53,7 +53,7 @@ func NewClient(ctx context.Context, config *Config) (*Client, error) {
func
(
client
*
Client
)
UploadFile
(
ctx
context
.
Context
,
filename
string
,
fileType
string
,
src
io
.
Reader
)
(
string
,
error
)
{
func
(
client
*
Client
)
UploadFile
(
ctx
context
.
Context
,
filename
string
,
fileType
string
,
src
io
.
Reader
)
(
string
,
error
)
{
uploader
:=
manager
.
NewUploader
(
client
.
Client
)
uploader
:=
manager
.
NewUploader
(
client
.
Client
)
resp
,
err
:=
uploader
.
Upload
(
ctx
,
&
awss3
.
PutObjectInput
{
uploadOutput
,
err
:=
uploader
.
Upload
(
ctx
,
&
awss3
.
PutObjectInput
{
Bucket
:
aws
.
String
(
client
.
Config
.
Bucket
),
Bucket
:
aws
.
String
(
client
.
Config
.
Bucket
),
Key
:
aws
.
String
(
filename
),
Key
:
aws
.
String
(
filename
),
Body
:
src
,
Body
:
src
,
...
@@ -63,10 +63,12 @@ func (client *Client) UploadFile(ctx context.Context, filename string, fileType
...
@@ -63,10 +63,12 @@ func (client *Client) UploadFile(ctx context.Context, filename string, fileType
if
err
!=
nil
{
if
err
!=
nil
{
return
""
,
err
return
""
,
err
}
}
var
link
string
link
:=
uploadOutput
.
Location
if
link
==
""
{
if
client
.
Config
.
URLPrefix
==
""
{
if
client
.
Config
.
URLPrefix
==
""
{
link
=
resp
.
Location
return
""
,
fmt
.
Errorf
(
"url prefix is empty"
)
}
else
{
}
link
=
fmt
.
Sprintf
(
"%s/%s"
,
client
.
Config
.
URLPrefix
,
filename
)
link
=
fmt
.
Sprintf
(
"%s/%s"
,
client
.
Config
.
URLPrefix
,
filename
)
}
}
return
link
,
nil
return
link
,
nil
...
...
server/profile/profile.go
View file @
977e7f55
...
@@ -24,6 +24,10 @@ type Profile struct {
...
@@ -24,6 +24,10 @@ type Profile struct {
Version
string
`json:"version"`
Version
string
`json:"version"`
}
}
func
(
p
*
Profile
)
IsDev
()
bool
{
return
p
.
Mode
!=
"prod"
}
func
checkDSN
(
dataDir
string
)
(
string
,
error
)
{
func
checkDSN
(
dataDir
string
)
(
string
,
error
)
{
// Convert to absolute path if relative path is supplied.
// Convert to absolute path if relative path is supplied.
if
!
filepath
.
IsAbs
(
dataDir
)
{
if
!
filepath
.
IsAbs
(
dataDir
)
{
...
...
server/resource.go
View file @
977e7f55
...
@@ -42,6 +42,7 @@ func (s *Server) registerResourceRoutes(g *echo.Group) {
...
@@ -42,6 +42,7 @@ func (s *Server) registerResourceRoutes(g *echo.Group) {
if
resourceCreate
.
ExternalLink
!=
""
&&
!
strings
.
HasPrefix
(
resourceCreate
.
ExternalLink
,
"http"
)
{
if
resourceCreate
.
ExternalLink
!=
""
&&
!
strings
.
HasPrefix
(
resourceCreate
.
ExternalLink
,
"http"
)
{
return
echo
.
NewHTTPError
(
http
.
StatusBadRequest
,
"Invalid external link"
)
return
echo
.
NewHTTPError
(
http
.
StatusBadRequest
,
"Invalid external link"
)
}
}
resourceCreate
.
Visibility
=
api
.
Private
resource
,
err
:=
s
.
Store
.
CreateResource
(
ctx
,
resourceCreate
)
resource
,
err
:=
s
.
Store
.
CreateResource
(
ctx
,
resourceCreate
)
if
err
!=
nil
{
if
err
!=
nil
{
return
echo
.
NewHTTPError
(
http
.
StatusInternalServerError
,
"Failed to create resource"
)
.
SetInternal
(
err
)
return
echo
.
NewHTTPError
(
http
.
StatusInternalServerError
,
"Failed to create resource"
)
.
SetInternal
(
err
)
...
@@ -104,6 +105,7 @@ func (s *Server) registerResourceRoutes(g *echo.Group) {
...
@@ -104,6 +105,7 @@ func (s *Server) registerResourceRoutes(g *echo.Group) {
Type
:
filetype
,
Type
:
filetype
,
Size
:
size
,
Size
:
size
,
Blob
:
fileBytes
,
Blob
:
fileBytes
,
Visibility
:
api
.
Private
,
}
}
}
else
{
}
else
{
storage
,
err
:=
s
.
Store
.
FindStorage
(
ctx
,
&
api
.
StorageFind
{
ID
:
&
storageServiceID
})
storage
,
err
:=
s
.
Store
.
FindStorage
(
ctx
,
&
api
.
StorageFind
{
ID
:
&
storageServiceID
})
...
@@ -134,6 +136,7 @@ func (s *Server) registerResourceRoutes(g *echo.Group) {
...
@@ -134,6 +136,7 @@ func (s *Server) registerResourceRoutes(g *echo.Group) {
Filename
:
filename
,
Filename
:
filename
,
Type
:
filetype
,
Type
:
filetype
,
ExternalLink
:
link
,
ExternalLink
:
link
,
Visibility
:
api
.
Private
,
}
}
}
else
{
}
else
{
return
echo
.
NewHTTPError
(
http
.
StatusInternalServerError
,
"Unsupported storage type"
)
return
echo
.
NewHTTPError
(
http
.
StatusInternalServerError
,
"Unsupported storage type"
)
...
...
store/db/migration/dev/LATEST__SCHEMA.sql
View file @
977e7f55
...
@@ -76,7 +76,8 @@ CREATE TABLE resource (
...
@@ -76,7 +76,8 @@ CREATE TABLE resource (
blob
BLOB
DEFAULT
NULL
,
blob
BLOB
DEFAULT
NULL
,
external_link
TEXT
NOT
NULL
DEFAULT
''
,
external_link
TEXT
NOT
NULL
DEFAULT
''
,
type
TEXT
NOT
NULL
DEFAULT
''
,
type
TEXT
NOT
NULL
DEFAULT
''
,
size
INTEGER
NOT
NULL
DEFAULT
0
size
INTEGER
NOT
NULL
DEFAULT
0
,
visibility
TEXT
NOT
NULL
CHECK
(
visibility
IN
(
'PUBLIC'
,
'PROTECTED'
,
'PRIVATE'
))
DEFAULT
'PRIVATE'
);
);
-- memo_resource
-- memo_resource
...
...
store/resource.go
View file @
977e7f55
...
@@ -27,6 +27,7 @@ type resourceRaw struct {
...
@@ -27,6 +27,7 @@ type resourceRaw struct {
ExternalLink
string
ExternalLink
string
Type
string
Type
string
Size
int64
Size
int64
Visibility
api
.
Visibility
}
}
func
(
raw
*
resourceRaw
)
toResource
()
*
api
.
Resource
{
func
(
raw
*
resourceRaw
)
toResource
()
*
api
.
Resource
{
...
@@ -44,6 +45,7 @@ func (raw *resourceRaw) toResource() *api.Resource {
...
@@ -44,6 +45,7 @@ func (raw *resourceRaw) toResource() *api.Resource {
ExternalLink
:
raw
.
ExternalLink
,
ExternalLink
:
raw
.
ExternalLink
,
Type
:
raw
.
Type
,
Type
:
raw
.
Type
,
Size
:
raw
.
Size
,
Size
:
raw
.
Size
,
Visibility
:
raw
.
Visibility
,
}
}
}
}
...
@@ -88,7 +90,7 @@ func (s *Store) CreateResource(ctx context.Context, create *api.ResourceCreate)
...
@@ -88,7 +90,7 @@ func (s *Store) CreateResource(ctx context.Context, create *api.ResourceCreate)
}
}
defer
tx
.
Rollback
()
defer
tx
.
Rollback
()
resourceRaw
,
err
:=
createResource
(
ctx
,
tx
,
create
)
resourceRaw
,
err
:=
s
.
createResourceImpl
(
ctx
,
tx
,
create
)
if
err
!=
nil
{
if
err
!=
nil
{
return
nil
,
err
return
nil
,
err
}
}
...
@@ -109,7 +111,7 @@ func (s *Store) FindResourceList(ctx context.Context, find *api.ResourceFind) ([
...
@@ -109,7 +111,7 @@ func (s *Store) FindResourceList(ctx context.Context, find *api.ResourceFind) ([
}
}
defer
tx
.
Rollback
()
defer
tx
.
Rollback
()
resourceRawList
,
err
:=
findResourceList
(
ctx
,
tx
,
find
)
resourceRawList
,
err
:=
s
.
findResourceListImpl
(
ctx
,
tx
,
find
)
if
err
!=
nil
{
if
err
!=
nil
{
return
nil
,
err
return
nil
,
err
}
}
...
@@ -129,7 +131,7 @@ func (s *Store) FindResource(ctx context.Context, find *api.ResourceFind) (*api.
...
@@ -129,7 +131,7 @@ func (s *Store) FindResource(ctx context.Context, find *api.ResourceFind) (*api.
}
}
defer
tx
.
Rollback
()
defer
tx
.
Rollback
()
list
,
err
:=
findResourceList
(
ctx
,
tx
,
find
)
list
,
err
:=
s
.
findResourceListImpl
(
ctx
,
tx
,
find
)
if
err
!=
nil
{
if
err
!=
nil
{
return
nil
,
err
return
nil
,
err
}
}
...
@@ -172,7 +174,7 @@ func (s *Store) PatchResource(ctx context.Context, patch *api.ResourcePatch) (*a
...
@@ -172,7 +174,7 @@ func (s *Store) PatchResource(ctx context.Context, patch *api.ResourcePatch) (*a
}
}
defer
tx
.
Rollback
()
defer
tx
.
Rollback
()
resourceRaw
,
err
:=
patchResource
(
ctx
,
tx
,
patch
)
resourceRaw
,
err
:=
s
.
patchResourceImpl
(
ctx
,
tx
,
patch
)
if
err
!=
nil
{
if
err
!=
nil
{
return
nil
,
err
return
nil
,
err
}
}
...
@@ -186,21 +188,25 @@ func (s *Store) PatchResource(ctx context.Context, patch *api.ResourcePatch) (*a
...
@@ -186,21 +188,25 @@ func (s *Store) PatchResource(ctx context.Context, patch *api.ResourcePatch) (*a
return
resource
,
nil
return
resource
,
nil
}
}
func
createResource
(
ctx
context
.
Context
,
tx
*
sql
.
Tx
,
create
*
api
.
ResourceCreate
)
(
*
resourceRaw
,
error
)
{
func
(
s
*
Store
)
createResourceImpl
(
ctx
context
.
Context
,
tx
*
sql
.
Tx
,
create
*
api
.
ResourceCreate
)
(
*
resourceRaw
,
error
)
{
fields
:=
[]
string
{
"filename"
,
"blob"
,
"external_link"
,
"type"
,
"size"
,
"creator_id"
}
values
:=
[]
interface
{}{
create
.
Filename
,
create
.
Blob
,
create
.
ExternalLink
,
create
.
Type
,
create
.
Size
,
create
.
CreatorID
}
placeholders
:=
[]
string
{
"?"
,
"?"
,
"?"
,
"?"
,
"?"
,
"?"
}
if
s
.
profile
.
IsDev
()
{
fields
=
append
(
fields
,
"visibility"
)
values
=
append
(
values
,
create
.
Visibility
)
placeholders
=
append
(
placeholders
,
"?"
)
}
query
:=
`
query
:=
`
INSERT INTO resource (
INSERT INTO resource (
filename,
`
+
strings
.
Join
(
fields
,
","
)
+
`
blob,
external_link,
type,
size,
creator_id
)
)
VALUES (
?, ?, ?, ?, ?, ?
)
VALUES (
`
+
strings
.
Join
(
placeholders
,
","
)
+
`
)
RETURNING id,
filename, blob, external_link, type, size, creator_id
, created_ts, updated_ts
RETURNING id,
`
+
strings
.
Join
(
fields
,
","
)
+
`
, created_ts, updated_ts
`
`
var
resourceRaw
resourceRaw
var
resourceRaw
resourceRaw
if
err
:=
tx
.
QueryRowContext
(
ctx
,
query
,
create
.
Filename
,
create
.
Blob
,
create
.
ExternalLink
,
create
.
Type
,
create
.
Size
,
create
.
CreatorID
)
.
Scan
(
dests
:=
[]
interface
{}{
&
resourceRaw
.
ID
,
&
resourceRaw
.
ID
,
&
resourceRaw
.
Filename
,
&
resourceRaw
.
Filename
,
&
resourceRaw
.
Blob
,
&
resourceRaw
.
Blob
,
...
@@ -208,16 +214,19 @@ func createResource(ctx context.Context, tx *sql.Tx, create *api.ResourceCreate)
...
@@ -208,16 +214,19 @@ func createResource(ctx context.Context, tx *sql.Tx, create *api.ResourceCreate)
&
resourceRaw
.
Type
,
&
resourceRaw
.
Type
,
&
resourceRaw
.
Size
,
&
resourceRaw
.
Size
,
&
resourceRaw
.
CreatorID
,
&
resourceRaw
.
CreatorID
,
&
resourceRaw
.
CreatedTs
,
}
&
resourceRaw
.
UpdatedTs
,
if
s
.
profile
.
IsDev
()
{
);
err
!=
nil
{
dests
=
append
(
dests
,
&
resourceRaw
.
Visibility
)
}
dests
=
append
(
dests
,
[]
interface
{}{
&
resourceRaw
.
CreatedTs
,
&
resourceRaw
.
UpdatedTs
}
...
)
if
err
:=
tx
.
QueryRowContext
(
ctx
,
query
,
values
...
)
.
Scan
(
dests
...
);
err
!=
nil
{
return
nil
,
FormatError
(
err
)
return
nil
,
FormatError
(
err
)
}
}
return
&
resourceRaw
,
nil
return
&
resourceRaw
,
nil
}
}
func
patchResource
(
ctx
context
.
Context
,
tx
*
sql
.
Tx
,
patch
*
api
.
ResourcePatch
)
(
*
resourceRaw
,
error
)
{
func
(
s
*
Store
)
patchResourceImpl
(
ctx
context
.
Context
,
tx
*
sql
.
Tx
,
patch
*
api
.
ResourcePatch
)
(
*
resourceRaw
,
error
)
{
set
,
args
:=
[]
string
{},
[]
interface
{}{}
set
,
args
:=
[]
string
{},
[]
interface
{}{}
if
v
:=
patch
.
UpdatedTs
;
v
!=
nil
{
if
v
:=
patch
.
UpdatedTs
;
v
!=
nil
{
...
@@ -226,34 +235,46 @@ func patchResource(ctx context.Context, tx *sql.Tx, patch *api.ResourcePatch) (*
...
@@ -226,34 +235,46 @@ func patchResource(ctx context.Context, tx *sql.Tx, patch *api.ResourcePatch) (*
if
v
:=
patch
.
Filename
;
v
!=
nil
{
if
v
:=
patch
.
Filename
;
v
!=
nil
{
set
,
args
=
append
(
set
,
"filename = ?"
),
append
(
args
,
*
v
)
set
,
args
=
append
(
set
,
"filename = ?"
),
append
(
args
,
*
v
)
}
}
if
s
.
profile
.
IsDev
()
{
if
v
:=
patch
.
Visibility
;
v
!=
nil
{
set
,
args
=
append
(
set
,
"visibility = ?"
),
append
(
args
,
*
v
)
}
}
args
=
append
(
args
,
patch
.
ID
)
args
=
append
(
args
,
patch
.
ID
)
fields
:=
[]
string
{
"id"
,
"filename"
,
"external_link"
,
"type"
,
"size"
,
"creator_id"
,
"created_ts"
,
"updated_ts"
}
if
s
.
profile
.
IsDev
()
{
fields
=
append
(
fields
,
"visibility"
)
}
query
:=
`
query
:=
`
UPDATE resource
UPDATE resource
SET `
+
strings
.
Join
(
set
,
", "
)
+
`
SET `
+
strings
.
Join
(
set
,
", "
)
+
`
WHERE id = ?
WHERE id = ?
RETURNING id, filename, blob, external_link, type, size, creator_id, created_ts, updated_ts
RETURNING `
+
strings
.
Join
(
fields
,
", "
)
`
var
resourceRaw
resourceRaw
var
resourceRaw
resourceRaw
if
err
:=
tx
.
QueryRowContext
(
ctx
,
query
,
args
...
)
.
Scan
(
dests
:=
[]
interface
{}{
&
resourceRaw
.
ID
,
&
resourceRaw
.
ID
,
&
resourceRaw
.
Filename
,
&
resourceRaw
.
Filename
,
&
resourceRaw
.
Blob
,
&
resourceRaw
.
ExternalLink
,
&
resourceRaw
.
ExternalLink
,
&
resourceRaw
.
Type
,
&
resourceRaw
.
Type
,
&
resourceRaw
.
Size
,
&
resourceRaw
.
Size
,
&
resourceRaw
.
CreatorID
,
&
resourceRaw
.
CreatorID
,
&
resourceRaw
.
CreatedTs
,
&
resourceRaw
.
CreatedTs
,
&
resourceRaw
.
UpdatedTs
,
&
resourceRaw
.
UpdatedTs
,
);
err
!=
nil
{
}
if
s
.
profile
.
IsDev
()
{
dests
=
append
(
dests
,
&
resourceRaw
.
Visibility
)
}
if
err
:=
tx
.
QueryRowContext
(
ctx
,
query
,
args
...
)
.
Scan
(
dests
...
);
err
!=
nil
{
return
nil
,
FormatError
(
err
)
return
nil
,
FormatError
(
err
)
}
}
return
&
resourceRaw
,
nil
return
&
resourceRaw
,
nil
}
}
func
findResourceList
(
ctx
context
.
Context
,
tx
*
sql
.
Tx
,
find
*
api
.
ResourceFind
)
([]
*
resourceRaw
,
error
)
{
func
(
s
*
Store
)
findResourceListImpl
(
ctx
context
.
Context
,
tx
*
sql
.
Tx
,
find
*
api
.
ResourceFind
)
([]
*
resourceRaw
,
error
)
{
where
,
args
:=
[]
string
{
"1 = 1"
},
[]
interface
{}{}
where
,
args
:=
[]
string
{
"1 = 1"
},
[]
interface
{}{}
if
v
:=
find
.
ID
;
v
!=
nil
{
if
v
:=
find
.
ID
;
v
!=
nil
{
...
@@ -273,6 +294,9 @@ func findResourceList(ctx context.Context, tx *sql.Tx, find *api.ResourceFind) (
...
@@ -273,6 +294,9 @@ func findResourceList(ctx context.Context, tx *sql.Tx, find *api.ResourceFind) (
if
find
.
GetBlob
{
if
find
.
GetBlob
{
fields
=
append
(
fields
,
"blob"
)
fields
=
append
(
fields
,
"blob"
)
}
}
if
s
.
profile
.
IsDev
()
{
fields
=
append
(
fields
,
"visibility"
)
}
query
:=
fmt
.
Sprintf
(
`
query
:=
fmt
.
Sprintf
(
`
SELECT
SELECT
...
@@ -290,7 +314,7 @@ func findResourceList(ctx context.Context, tx *sql.Tx, find *api.ResourceFind) (
...
@@ -290,7 +314,7 @@ func findResourceList(ctx context.Context, tx *sql.Tx, find *api.ResourceFind) (
resourceRawList
:=
make
([]
*
resourceRaw
,
0
)
resourceRawList
:=
make
([]
*
resourceRaw
,
0
)
for
rows
.
Next
()
{
for
rows
.
Next
()
{
var
resourceRaw
resourceRaw
var
resourceRaw
resourceRaw
dest
:=
[]
interface
{}{
dest
s
:=
[]
interface
{}{
&
resourceRaw
.
ID
,
&
resourceRaw
.
ID
,
&
resourceRaw
.
Filename
,
&
resourceRaw
.
Filename
,
&
resourceRaw
.
ExternalLink
,
&
resourceRaw
.
ExternalLink
,
...
@@ -301,11 +325,12 @@ func findResourceList(ctx context.Context, tx *sql.Tx, find *api.ResourceFind) (
...
@@ -301,11 +325,12 @@ func findResourceList(ctx context.Context, tx *sql.Tx, find *api.ResourceFind) (
&
resourceRaw
.
UpdatedTs
,
&
resourceRaw
.
UpdatedTs
,
}
}
if
find
.
GetBlob
{
if
find
.
GetBlob
{
dest
=
append
(
dest
,
&
resourceRaw
.
Blob
)
dests
=
append
(
dests
,
&
resourceRaw
.
Blob
)
}
if
s
.
profile
.
IsDev
()
{
dests
=
append
(
dests
,
&
resourceRaw
.
Visibility
)
}
}
if
err
:=
rows
.
Scan
(
if
err
:=
rows
.
Scan
(
dests
...
);
err
!=
nil
{
dest
...
,
);
err
!=
nil
{
return
nil
,
FormatError
(
err
)
return
nil
,
FormatError
(
err
)
}
}
...
...
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