Skip to content
Snippets Groups Projects
Commit d1594aa8 authored by Valera Shaitorov's avatar Valera Shaitorov :alien:
Browse files

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

parent 38344112
No related branches found
No related tags found
No related merge requests found
Subproject commit 8606df02e0df6807e503bf22471a295020a47fba
Subproject commit f000812a1eef24093c0d0abf1318e3179b679773
......@@ -10,7 +10,9 @@ import (
)
type BatchProcessor struct {
Items Items
Items Items // fixme: после того как здесь Content поменяли на Items (из-за цикличного импорта)
// использование в perxis BatchProcessor'a необходимо менять
// стоит ли это так делать или лучше в perxis-go BatchProcessor вынести в отдельный пакет чтобы не было цикличного импорта?
SpaceID, EnvID, CollectionID string
FindOptions *FindOptions
FindPublishedOptions *FindPublishedOptions
......
......@@ -149,3 +149,25 @@ func EncodeAggregateResult(ctx context.Context, request map[string]string, r map
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