Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
P
perxis-go
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Package registry
Operate
Terraform modules
Analyze
Contributor analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
perxis
perxis-go
Commits
fe763db2
Commit
fe763db2
authored
7 months ago
by
Danis Kirasirov
Browse files
Options
Downloads
Patches
Plain Diff
add params
parent
88a1a483
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
pkg/items/item.go
+3
-3
3 additions, 3 deletions
pkg/items/item.go
pkg/schema/schema.go
+6
-5
6 additions, 5 deletions
pkg/schema/schema.go
with
9 additions
and
8 deletions
pkg/items/item.go
+
3
−
3
View file @
fe763db2
...
@@ -293,11 +293,11 @@ func (i *Item) Encode(ctx context.Context, s *schema.Schema) (*Item, error) {
...
@@ -293,11 +293,11 @@ func (i *Item) Encode(ctx context.Context, s *schema.Schema) (*Item, error) {
return
&
res
,
nil
return
&
res
,
nil
}
}
func
(
i
*
Item
)
Decode
(
ctx
context
.
Context
,
s
*
schema
.
Schema
)
(
*
Item
,
error
)
{
func
(
i
*
Item
)
Decode
(
ctx
context
.
Context
,
s
*
schema
.
Schema
,
opts
...
field
.
EncodeOption
)
(
*
Item
,
error
)
{
res
:=
*
i
res
:=
*
i
var
err
error
var
err
error
if
i
.
Data
!=
nil
{
if
i
.
Data
!=
nil
{
res
.
Data
,
err
=
s
.
Decode
(
ctx
,
i
.
Data
)
res
.
Data
,
err
=
s
.
Decode
(
ctx
,
i
.
Data
,
opts
...
)
if
err
!=
nil
{
if
err
!=
nil
{
return
nil
,
err
return
nil
,
err
}
}
...
@@ -309,7 +309,7 @@ func (i *Item) Decode(ctx context.Context, s *schema.Schema) (*Item, error) {
...
@@ -309,7 +309,7 @@ func (i *Item) Decode(ctx context.Context, s *schema.Schema) (*Item, error) {
res
.
Translations
[
l
]
=
v
res
.
Translations
[
l
]
=
v
continue
continue
}
}
dt
,
err
:=
schema
.
Decode
(
ctx
,
s
,
v
)
dt
,
err
:=
schema
.
Decode
(
ctx
,
s
,
v
,
opts
...
)
//nolint:govet // err shadows
if
err
!=
nil
{
if
err
!=
nil
{
return
nil
,
err
return
nil
,
err
}
}
...
...
This diff is collapsed.
Click to expand it.
pkg/schema/schema.go
+
6
−
5
View file @
fe763db2
...
@@ -148,16 +148,17 @@ func (s *Schema) Evaluate(ctx context.Context, data map[string]interface{}) (res
...
@@ -148,16 +148,17 @@ func (s *Schema) Evaluate(ctx context.Context, data map[string]interface{}) (res
return
return
}
}
func
(
s
*
Schema
)
Decode
(
ctx
context
.
Context
,
v
interface
{}
)
(
res
map
[
string
]
interface
{},
err
error
)
{
func
(
s
*
Schema
)
Decode
(
ctx
context
.
Context
,
v
interface
{}
,
opt
...
field
.
EncodeOption
)
(
map
[
string
]
interface
{},
error
)
{
if
err
=
s
.
Load
(
ctx
);
err
!=
nil
{
if
err
:
=
s
.
Load
(
ctx
);
err
!=
nil
{
return
nil
,
err
return
nil
,
err
}
}
if
v
,
err
=
Decode
(
ctx
,
s
,
v
);
err
!=
nil
{
v
,
err
:=
Decode
(
ctx
,
s
,
v
,
opt
...
)
if
err
!=
nil
{
return
nil
,
err
return
nil
,
err
}
}
res
,
_
=
v
.
(
map
[
string
]
interface
{})
res
,
_
:
=
v
.
(
map
[
string
]
interface
{})
return
return
res
,
err
}
}
func
(
s
*
Schema
)
Encode
(
ctx
context
.
Context
,
v
interface
{})
(
interface
{},
error
)
{
func
(
s
*
Schema
)
Encode
(
ctx
context
.
Context
,
v
interface
{})
(
interface
{},
error
)
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment