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
d0e97459
Commit
d0e97459
authored
1 year ago
by
Danis Kirasirov
Committed by
Pavel Antonov
1 year ago
Browse files
Options
Downloads
Patches
Plain Diff
Добавлено системное поле SearchScore в Item
parent
8ca77dad
No related branches found
No related tags found
No related merge requests found
Changes
4
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
perxis-proto
+1
-1
1 addition, 1 deletion
perxis-proto
pkg/items/item.go
+12
-1
12 additions, 1 deletion
pkg/items/item.go
proto/items/items.pb.go
+412
-401
412 additions, 401 deletions
proto/items/items.pb.go
proto/items/items_grpc.pb.go
+1
-1
1 addition, 1 deletion
proto/items/items_grpc.pb.go
with
426 additions
and
404 deletions
perxis-proto
@
0c9587bc
Compare
2fd02d31
...
0c9587bc
Subproject commit
2fd02d31a11e9c98547acc4f8416d17c5367411
c
Subproject commit
0c9587bc749ae4150552445173078ab5b36ef42
c
This diff is collapsed.
Click to expand it.
pkg/items/item.go
+
12
−
1
View file @
d0e97459
...
...
@@ -76,6 +76,7 @@ var SystemFields = []string{
"deleted"
,
"hidden"
,
"template"
,
"search_score"
,
}
type
Permissions
struct
{
...
...
@@ -103,6 +104,7 @@ type Item struct {
RevisionID
string
`json:"revId,omitempty" bson:"revision_id"`
RevisionDescription
string
`json:"revDescription,omitempty" bson:"revision_description"`
Permissions
*
Permissions
`json:"permissions,omitempty" bson:"-"`
SearchScore
float64
`json:"searchScore,omitempty" bson:"search_score,omitempty"`
// Флаги записи
Deleted
bool
`json:"deleted" bson:"deleted,omitempty"`
...
...
@@ -155,6 +157,7 @@ func (i *Item) ToMap() map[string]interface{} {
"deleted"
:
i
.
Deleted
,
"hidden"
:
i
.
Hidden
,
"template"
:
i
.
Template
,
"search_score"
:
i
.
SearchScore
,
}
}
...
...
@@ -315,6 +318,8 @@ func (i *Item) SetSystemField(field string, value interface{}) error {
i
.
Deleted
,
ok
=
value
.
(
bool
)
case
"template"
:
i
.
Template
,
ok
=
value
.
(
bool
)
case
"search_score"
:
i
.
SearchScore
,
ok
=
value
.
(
float64
)
default
:
return
ErrNotSystemField
}
...
...
@@ -326,7 +331,7 @@ func (i *Item) SetSystemField(field string, value interface{}) error {
return
nil
}
// GetSystem
устанавлив
ает значение системного поля
// GetSystem
возвращ
ает значение системного поля
func
(
i
*
Item
)
GetSystem
(
field
string
)
(
any
,
error
)
{
switch
field
{
case
"id"
:
...
...
@@ -357,6 +362,8 @@ func (i *Item) GetSystem(field string) (any, error) {
return
i
.
Deleted
,
nil
case
"template"
:
return
i
.
Template
,
nil
case
"search_score"
:
return
i
.
SearchScore
,
nil
}
return
nil
,
ErrNotSystemField
...
...
@@ -419,6 +426,8 @@ func GetSystemField(fld string) (*field.Field, error) {
return
field
.
String
(),
nil
case
"hidden"
,
"deleted"
,
"template"
:
return
field
.
Bool
(),
nil
case
"search_score"
:
return
field
.
Number
(
field
.
NumberFormatFloat
),
nil
}
return
nil
,
ErrNotSystemField
...
...
@@ -469,6 +478,7 @@ func ItemToProto(item *Item) *pb.Item {
Hidden
:
item
.
Hidden
,
Template
:
item
.
Template
,
Deleted
:
item
.
Deleted
,
SearchScore
:
item
.
SearchScore
,
}
if
item
.
Data
!=
nil
{
...
...
@@ -518,6 +528,7 @@ func ItemFromProto(protoItem *pb.Item) *Item {
Hidden
:
protoItem
.
Hidden
,
Template
:
protoItem
.
Template
,
Deleted
:
protoItem
.
Deleted
,
SearchScore
:
protoItem
.
SearchScore
,
}
if
protoItem
.
Data
!=
nil
{
...
...
This diff is collapsed.
Click to expand it.
proto/items/items.pb.go
+
412
−
401
View file @
d0e97459
This diff is collapsed.
Click to expand it.
proto/items/items_grpc.pb.go
+
1
−
1
View file @
d0e97459
...
...
@@ -9,7 +9,7 @@
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions:
// - protoc-gen-go-grpc v1.3.0
// - protoc v4.2
4.3
// - protoc v4.2
5.1
// source: items/items.proto
package
items
...
...
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