service

package
v0.0.0-...-3e05ab6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 27, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type VersionService

type VersionService struct {
	// contains filtered or unexported fields
}

VersionService — слой логики версионирования, использующий интерфейс VersionStorage.

func NewVersionService

func NewVersionService(storage store.IVersionStorage, snapshotInterval int) *VersionService

NewVersionService создаёт новый сервис

func (*VersionService) CreateDocument

func (s *VersionService) CreateDocument(name string) (*models.Document, error)

func (*VersionService) DiffVersions

func (s *VersionService) DiffVersions(v1ID, v2ID uuid.UUID) ([]byte, error)

DiffVersions создаёт JSON Merge Patch между двумя версиями. Возвращает JSON-патч (diff), показывающий, какие поля изменились.

func (*VersionService) ReconstructVersion

func (s *VersionService) ReconstructVersion(versionID uuid.UUID) ([]byte, error)

ReconstructVersion восстанавливает полную JSON-версию по ID Патчи — в формате JSON Merge Patch (RFC 7386) применяются последовательно к ближайшему snapshot.

func (*VersionService) SaveNewVersion

func (s *VersionService) SaveNewVersion(docID uuid.UUID, newJSON []byte) (*models.Version, error)

SaveNewVersion создаёт новую версию документа (merge-patch или snapshot)

func (*VersionService) SetSnapshotInterval

func (s *VersionService) SetSnapshotInterval(n int)

SetSnapshotInterval задаёт через сколько версий сохранять snapshot (если >0)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
⌂ 换网址