Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Document ¶
type Document struct {
ID uuid.UUID `json:"id" gorm:"type:uuid;default:gen_random_uuid();primaryKey" example:"550e8400-e29b-41d4-a716-446655440000"`
Name string `json:"name" example:"My Document"`
CreatedAt time.Time `json:"created_at" example:"2025-01-02T15:04:05Z"`
UpdatedAt time.Time `json:"updated_at" example:"2025-01-02T15:04:05Z"`
LatestVersion uuid.UUID `json:"latest_version" gorm:"type:uuid;" example:"c3e474u0-e29b-41d4-a716-446655440000"`
}
Document документ в системе @Description Document — контейнер, объединяющий версии и снапшоты. @Description Сам по себе не содержит данных (они находятся в версиях и снапшотах). swagger:model Document
type Version ¶
type Version struct {
ID uuid.UUID `json:"id" gorm:"type:uuid;default:gen_random_uuid();primaryKey" example:"550e8400-e29b-41d4-a716-446655440000"`
DocumentID uuid.UUID `json:"document_id" gorm:"type:uuid;index" example:"550e8400-e29b-41d4-a716-446655440000"`
Document *Document `json:"-" gorm:"foreignKey:DocumentID;references:ID;constraint:OnDelete:CASCADE,OnUpdate:CASCADE;"`
ParentID *uuid.UUID `json:"parent_id,omitempty" gorm:"type:uuid;" example:"null"`
IsSnapshot bool `json:"is_snapshot" example:"false"`
// JSON Patch или nil, если Snapshot
Patch json.RawMessage `json:"patch,omitempty" gorm:"type:json"`
// Полный JSON, если IsSnapshot = true
Snapshot json.RawMessage `json:"snapshot,omitempty" gorm:"type:json"`
CreatedAt time.Time `json:"created_at" example:"2025-01-02T15:04:05Z"`
}
Version версия документа @Description Version хранит либо патч изменений (Patch), либо полный снимок состояния (Snapshot). @Description Если IsSnapshot=true — Snapshot содержит полное состояние документа, а Patch = null. @Description Если IsSnapshot=false — Patch содержит JSON Patch относительно предыдущей версии. swagger:model Version
Click to show internal directories.
Click to hide internal directories.