Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
corteza
corteza-server
Commits
8b6aa177
Commit
8b6aa177
authored
4 years ago
by
Tomaž Jerman
Committed by
Denis Arh
4 years ago
Browse files
Options
Download
Email Patches
Plain Diff
Add sys user export to .csv export
parent
6e05c2a6
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
28 additions
and
5 deletions
+28
-5
compose/encoder/record.go
compose/encoder/record.go
+28
-5
No files found.
compose/encoder/record.go
View file @
8b6aa177
...
...
@@ -22,7 +22,18 @@ func fmtUint64(u uint64) string {
return
strconv
.
FormatUint
(
u
,
10
)
}
func
(
enc
flatWriter
)
Record
(
r
*
types
.
Record
)
error
{
func
fmtSysUser
(
u
uint64
,
finder
userFinder
)
(
string
,
error
)
{
if
u
<=
0
||
finder
==
nil
{
return
fmtUint64
(
u
),
nil
}
su
,
err
:=
finder
(
u
)
if
err
!=
nil
{
return
""
,
err
}
return
su
.
Name
,
nil
}
func
(
enc
flatWriter
)
Record
(
r
*
types
.
Record
)
(
err
error
)
{
var
out
=
make
([]
string
,
len
(
enc
.
ff
))
for
f
,
field
:=
range
enc
.
ff
{
...
...
@@ -34,17 +45,29 @@ func (enc flatWriter) Record(r *types.Record) error {
case
"namespaceID"
:
out
[
f
]
=
fmtUint64
(
r
.
NamespaceID
)
case
"ownedBy"
:
out
[
f
]
=
fmtUint64
(
r
.
OwnedBy
)
out
[
f
],
err
=
fmtSysUser
(
r
.
OwnedBy
,
enc
.
u
)
if
err
!=
nil
{
return
err
}
case
"createdBy"
:
out
[
f
]
=
fmtUint64
(
r
.
CreatedBy
)
out
[
f
],
err
=
fmtSysUser
(
r
.
CreatedBy
,
enc
.
u
)
if
err
!=
nil
{
return
err
}
case
"createdAt"
:
out
[
f
]
=
fmtTime
(
&
r
.
CreatedAt
)
case
"updatedBy"
:
out
[
f
]
=
fmtUint64
(
r
.
UpdatedBy
)
out
[
f
],
err
=
fmtSysUser
(
r
.
UpdatedBy
,
enc
.
u
)
if
err
!=
nil
{
return
err
}
case
"updatedAt"
:
out
[
f
]
=
fmtTime
(
r
.
UpdatedAt
)
case
"deletedBy"
:
out
[
f
]
=
fmtUint64
(
r
.
DeletedBy
)
out
[
f
],
err
=
fmtSysUser
(
r
.
DeletedBy
,
enc
.
u
)
if
err
!=
nil
{
return
err
}
case
"deletedAt"
:
out
[
f
]
=
fmtTime
(
r
.
DeletedAt
)
default
:
...
...
This diff is collapsed.
Click to expand it.
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