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
087edb39
Commit
087edb39
authored
1 year ago
by
Pavel Antonov
Browse files
Options
Downloads
Plain Diff
feat(core): Добавлено системное поле SearchScore в Item
Close #PRXS-2445
parents
8ca77dad
d0e97459
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 @
087edb39
...
@@ -76,6 +76,7 @@ var SystemFields = []string{
...
@@ -76,6 +76,7 @@ var SystemFields = []string{
"deleted"
,
"deleted"
,
"hidden"
,
"hidden"
,
"template"
,
"template"
,
"search_score"
,
}
}
type
Permissions
struct
{
type
Permissions
struct
{
...
@@ -103,6 +104,7 @@ type Item struct {
...
@@ -103,6 +104,7 @@ type Item struct {
RevisionID
string
`json:"revId,omitempty" bson:"revision_id"`
RevisionID
string
`json:"revId,omitempty" bson:"revision_id"`
RevisionDescription
string
`json:"revDescription,omitempty" bson:"revision_description"`
RevisionDescription
string
`json:"revDescription,omitempty" bson:"revision_description"`
Permissions
*
Permissions
`json:"permissions,omitempty" bson:"-"`
Permissions
*
Permissions
`json:"permissions,omitempty" bson:"-"`
SearchScore
float64
`json:"searchScore,omitempty" bson:"search_score,omitempty"`
// Флаги записи
// Флаги записи
Deleted
bool
`json:"deleted" bson:"deleted,omitempty"`
Deleted
bool
`json:"deleted" bson:"deleted,omitempty"`
...
@@ -155,6 +157,7 @@ func (i *Item) ToMap() map[string]interface{} {
...
@@ -155,6 +157,7 @@ func (i *Item) ToMap() map[string]interface{} {
"deleted"
:
i
.
Deleted
,
"deleted"
:
i
.
Deleted
,
"hidden"
:
i
.
Hidden
,
"hidden"
:
i
.
Hidden
,
"template"
:
i
.
Template
,
"template"
:
i
.
Template
,
"search_score"
:
i
.
SearchScore
,
}
}
}
}
...
@@ -315,6 +318,8 @@ func (i *Item) SetSystemField(field string, value interface{}) error {
...
@@ -315,6 +318,8 @@ func (i *Item) SetSystemField(field string, value interface{}) error {
i
.
Deleted
,
ok
=
value
.
(
bool
)
i
.
Deleted
,
ok
=
value
.
(
bool
)
case
"template"
:
case
"template"
:
i
.
Template
,
ok
=
value
.
(
bool
)
i
.
Template
,
ok
=
value
.
(
bool
)
case
"search_score"
:
i
.
SearchScore
,
ok
=
value
.
(
float64
)
default
:
default
:
return
ErrNotSystemField
return
ErrNotSystemField
}
}
...
@@ -326,7 +331,7 @@ func (i *Item) SetSystemField(field string, value interface{}) error {
...
@@ -326,7 +331,7 @@ func (i *Item) SetSystemField(field string, value interface{}) error {
return
nil
return
nil
}
}
// GetSystem
устанавлив
ает значение системного поля
// GetSystem
возвращ
ает значение системного поля
func
(
i
*
Item
)
GetSystem
(
field
string
)
(
any
,
error
)
{
func
(
i
*
Item
)
GetSystem
(
field
string
)
(
any
,
error
)
{
switch
field
{
switch
field
{
case
"id"
:
case
"id"
:
...
@@ -357,6 +362,8 @@ func (i *Item) GetSystem(field string) (any, error) {
...
@@ -357,6 +362,8 @@ func (i *Item) GetSystem(field string) (any, error) {
return
i
.
Deleted
,
nil
return
i
.
Deleted
,
nil
case
"template"
:
case
"template"
:
return
i
.
Template
,
nil
return
i
.
Template
,
nil
case
"search_score"
:
return
i
.
SearchScore
,
nil
}
}
return
nil
,
ErrNotSystemField
return
nil
,
ErrNotSystemField
...
@@ -419,6 +426,8 @@ func GetSystemField(fld string) (*field.Field, error) {
...
@@ -419,6 +426,8 @@ func GetSystemField(fld string) (*field.Field, error) {
return
field
.
String
(),
nil
return
field
.
String
(),
nil
case
"hidden"
,
"deleted"
,
"template"
:
case
"hidden"
,
"deleted"
,
"template"
:
return
field
.
Bool
(),
nil
return
field
.
Bool
(),
nil
case
"search_score"
:
return
field
.
Number
(
field
.
NumberFormatFloat
),
nil
}
}
return
nil
,
ErrNotSystemField
return
nil
,
ErrNotSystemField
...
@@ -469,6 +478,7 @@ func ItemToProto(item *Item) *pb.Item {
...
@@ -469,6 +478,7 @@ func ItemToProto(item *Item) *pb.Item {
Hidden
:
item
.
Hidden
,
Hidden
:
item
.
Hidden
,
Template
:
item
.
Template
,
Template
:
item
.
Template
,
Deleted
:
item
.
Deleted
,
Deleted
:
item
.
Deleted
,
SearchScore
:
item
.
SearchScore
,
}
}
if
item
.
Data
!=
nil
{
if
item
.
Data
!=
nil
{
...
@@ -518,6 +528,7 @@ func ItemFromProto(protoItem *pb.Item) *Item {
...
@@ -518,6 +528,7 @@ func ItemFromProto(protoItem *pb.Item) *Item {
Hidden
:
protoItem
.
Hidden
,
Hidden
:
protoItem
.
Hidden
,
Template
:
protoItem
.
Template
,
Template
:
protoItem
.
Template
,
Deleted
:
protoItem
.
Deleted
,
Deleted
:
protoItem
.
Deleted
,
SearchScore
:
protoItem
.
SearchScore
,
}
}
if
protoItem
.
Data
!=
nil
{
if
protoItem
.
Data
!=
nil
{
...
...
This diff is collapsed.
Click to expand it.
proto/items/items.pb.go
+
412
−
401
View file @
087edb39
This diff is collapsed.
Click to expand it.
proto/items/items_grpc.pb.go
+
1
−
1
View file @
087edb39
...
@@ -9,7 +9,7 @@
...
@@ -9,7 +9,7 @@
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions:
// versions:
// - protoc-gen-go-grpc v1.3.0
// - protoc-gen-go-grpc v1.3.0
// - protoc v4.2
4.3
// - protoc v4.2
5.1
// source: items/items.proto
// source: items/items.proto
package
items
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