Skip to content
Snippets Groups Projects
Commit 70b94075 authored by Pavel Antonov's avatar Pavel Antonov :asterisk:
Browse files

Merge branch 'feature/PRXS-1285-ItemsFix' into 'master'

Добавлены пропущенные функции в пакет Items

See merge request perxis/perxis-go!51
parents 38344112 d1594aa8
No related branches found
No related tags found
No related merge requests found
Subproject commit 8606df02e0df6807e503bf22471a295020a47fba Subproject commit f000812a1eef24093c0d0abf1318e3179b679773
...@@ -10,7 +10,9 @@ import ( ...@@ -10,7 +10,9 @@ import (
) )
type BatchProcessor struct { type BatchProcessor struct {
Items Items Items Items // fixme: после того как здесь Content поменяли на Items (из-за цикличного импорта)
// использование в perxis BatchProcessor'a необходимо менять
// стоит ли это так делать или лучше в perxis-go BatchProcessor вынести в отдельный пакет чтобы не было цикличного импорта?
SpaceID, EnvID, CollectionID string SpaceID, EnvID, CollectionID string
FindOptions *FindOptions FindOptions *FindOptions
FindPublishedOptions *FindPublishedOptions FindPublishedOptions *FindPublishedOptions
......
...@@ -149,3 +149,25 @@ func EncodeAggregateResult(ctx context.Context, request map[string]string, r map ...@@ -149,3 +149,25 @@ func EncodeAggregateResult(ctx context.Context, request map[string]string, r map
return result, nil return result, nil
} }
func CreateAndPublishItem(ctx context.Context, items Items, item *Item) error {
var err error
if item, err = items.Create(ctx, item); err != nil {
return errors.Wrap(err, "create item")
}
if err = items.Publish(ctx, item); err != nil {
return errors.Wrap(err, "publish item")
}
return nil
}
func UpdateAndPublishItem(ctx context.Context, items Items, item *Item) error {
var err error
if err = items.Update(ctx, item); err != nil {
return errors.Wrap(err, "update item")
}
if err = items.Publish(ctx, item); err != nil {
return errors.Wrap(err, "publish item")
}
return nil
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment