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
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
perxis
perxis-go
Commits
a47898af
Commit
a47898af
authored
1 year ago
by
Anton Sattarov
Browse files
Options
Downloads
Patches
Plain Diff
add revision_description
parent
98700c96
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
perxis-proto
+1
-1
1 addition, 1 deletion
perxis-proto
pkg/items/item.go
+50
-42
50 additions, 42 deletions
pkg/items/item.go
with
51 additions
and
43 deletions
perxis-proto
@
b6932f50
Compare
de4fde11
...
b6932f50
Subproject commit
de4fde11b4f304e1a9d27e41801003c0f77cbec6
Subproject commit
b6932f502c43944f278af9097607fd17af4b8b8d
This diff is collapsed.
Click to expand it.
pkg/items/item.go
+
50
−
42
View file @
a47898af
...
...
@@ -69,6 +69,7 @@ var SystemFields = []string{
"updated_at"
,
"updated_by"
,
"revision_id"
,
"revision_description"
,
"data"
,
"translations"
,
"locale"
,
...
...
@@ -136,23 +137,24 @@ func (i *Item) Clone() *Item {
func
(
i
*
Item
)
ToMap
()
map
[
string
]
interface
{}
{
return
map
[
string
]
interface
{}{
"id"
:
i
.
ID
,
"space_id"
:
i
.
SpaceID
,
"env_id"
:
i
.
EnvID
,
"collection_id"
:
i
.
CollectionID
,
"state"
:
i
.
State
,
"created_rev_at"
:
i
.
CreatedRevAt
,
"created_by"
:
i
.
CreatedBy
,
"created_at"
:
i
.
CreatedAt
,
"updated_at"
:
i
.
UpdatedAt
,
"updated_by"
:
i
.
UpdatedBy
,
"revision_id"
:
i
.
RevisionID
,
"data"
:
i
.
Data
,
"translations"
:
i
.
Translations
,
"locale"
:
i
.
Locale
,
"deleted"
:
i
.
Deleted
,
"hidden"
:
i
.
Hidden
,
"template"
:
i
.
Template
,
"id"
:
i
.
ID
,
"space_id"
:
i
.
SpaceID
,
"env_id"
:
i
.
EnvID
,
"collection_id"
:
i
.
CollectionID
,
"state"
:
i
.
State
,
"created_rev_at"
:
i
.
CreatedRevAt
,
"created_by"
:
i
.
CreatedBy
,
"created_at"
:
i
.
CreatedAt
,
"updated_at"
:
i
.
UpdatedAt
,
"updated_by"
:
i
.
UpdatedBy
,
"revision_id"
:
i
.
RevisionID
,
"revision_description"
:
i
.
RevisionDescription
,
"data"
:
i
.
Data
,
"translations"
:
i
.
Translations
,
"locale"
:
i
.
Locale
,
"deleted"
:
i
.
Deleted
,
"hidden"
:
i
.
Hidden
,
"template"
:
i
.
Template
,
}
}
...
...
@@ -305,6 +307,8 @@ func (i *Item) SetSystemField(field string, value interface{}) error {
i
.
UpdatedAt
,
ok
=
value
.
(
time
.
Time
)
case
"revision_id"
:
i
.
RevisionID
,
ok
=
value
.
(
string
)
case
"revision_description"
:
i
.
RevisionDescription
,
ok
=
value
.
(
string
)
case
"hidden"
:
i
.
Hidden
,
ok
=
value
.
(
bool
)
case
"deleted"
:
...
...
@@ -345,6 +349,8 @@ func (i *Item) GetSystem(field string) (any, error) {
return
i
.
UpdatedAt
,
nil
case
"revision_id"
:
return
i
.
RevisionID
,
nil
case
"revision_description"
:
return
i
.
RevisionDescription
,
nil
case
"hidden"
:
return
i
.
Hidden
,
nil
case
"deleted"
:
...
...
@@ -395,7 +401,7 @@ func (i *Item) Get(field string) (any, error) {
// GetSystemField возвращает описание поля для системных аттрибутов Item
func
GetSystemField
(
fld
string
)
(
*
field
.
Field
,
error
)
{
switch
fld
{
case
"id"
,
"space_id"
,
"env_id"
,
"collection_id"
,
"revision_id"
:
case
"id"
,
"space_id"
,
"env_id"
,
"collection_id"
,
"revision_id"
,
"revision_description"
:
return
field
.
String
(),
nil
case
"created_rev_at"
,
"created_at"
,
"updated_at"
,
"published_at"
:
return
field
.
Time
(),
nil
...
...
@@ -440,18 +446,19 @@ func ItemToProto(item *Item) *pb.Item {
}
protoItem
:=
&
pb
.
Item
{
Id
:
item
.
ID
,
SpaceId
:
item
.
SpaceID
,
EnvId
:
item
.
EnvID
,
CollectionId
:
item
.
CollectionID
,
State
:
pb
.
Item_State
(
item
.
State
),
CreatedBy
:
item
.
CreatedBy
,
UpdatedBy
:
item
.
UpdatedBy
,
RevisionId
:
item
.
RevisionID
,
Locale
:
item
.
Locale
,
Hidden
:
item
.
Hidden
,
Template
:
item
.
Template
,
Deleted
:
item
.
Deleted
,
Id
:
item
.
ID
,
SpaceId
:
item
.
SpaceID
,
EnvId
:
item
.
EnvID
,
CollectionId
:
item
.
CollectionID
,
State
:
pb
.
Item_State
(
item
.
State
),
CreatedBy
:
item
.
CreatedBy
,
UpdatedBy
:
item
.
UpdatedBy
,
RevisionId
:
item
.
RevisionID
,
RevisionDescription
:
item
.
RevisionDescription
,
Locale
:
item
.
Locale
,
Hidden
:
item
.
Hidden
,
Template
:
item
.
Template
,
Deleted
:
item
.
Deleted
,
}
if
item
.
Data
!=
nil
{
...
...
@@ -488,18 +495,19 @@ func ItemFromProto(protoItem *pb.Item) *Item {
}
item
:=
&
Item
{
ID
:
protoItem
.
Id
,
SpaceID
:
protoItem
.
SpaceId
,
EnvID
:
protoItem
.
EnvId
,
CollectionID
:
protoItem
.
CollectionId
,
State
:
State
(
protoItem
.
State
),
CreatedBy
:
protoItem
.
CreatedBy
,
UpdatedBy
:
protoItem
.
UpdatedBy
,
RevisionID
:
protoItem
.
RevisionId
,
Locale
:
protoItem
.
Locale
,
Hidden
:
protoItem
.
Hidden
,
Template
:
protoItem
.
Template
,
Deleted
:
protoItem
.
Deleted
,
ID
:
protoItem
.
Id
,
SpaceID
:
protoItem
.
SpaceId
,
EnvID
:
protoItem
.
EnvId
,
CollectionID
:
protoItem
.
CollectionId
,
State
:
State
(
protoItem
.
State
),
CreatedBy
:
protoItem
.
CreatedBy
,
UpdatedBy
:
protoItem
.
UpdatedBy
,
RevisionID
:
protoItem
.
RevisionId
,
RevisionDescription
:
protoItem
.
RevisionDescription
,
Locale
:
protoItem
.
Locale
,
Hidden
:
protoItem
.
Hidden
,
Template
:
protoItem
.
Template
,
Deleted
:
protoItem
.
Deleted
,
}
if
protoItem
.
Data
!=
nil
{
...
...
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