Docs: Improve code comments in internal/entity/file*.go

Signed-off-by: Michael Mayer <michael@photoprism.app>
This commit is contained in:
Michael Mayer
2025-10-02 15:55:44 +02:00
parent 59b54663d8
commit cdea0e5664
3 changed files with 21 additions and 20 deletions

View File

@@ -13,7 +13,7 @@ const (
FileSyncUploaded = "uploaded"
)
// FileSync represents a one-to-many relation between File and Account for syncing with remote services.
// FileSync tracks the synchronization status for a file on an external service.
type FileSync struct {
RemoteName string `gorm:"primary_key;auto_increment:false;type:VARBINARY(255)"`
ServiceID uint `gorm:"primary_key;auto_increment:false"`
@@ -34,7 +34,7 @@ func (FileSync) TableName() string {
return "files_sync"
}
// NewFileSync creates a new entity.
// NewFileSync creates a new sync record with status preset to "new".
func NewFileSync(accountID uint, remoteName string) *FileSync {
result := &FileSync{
ServiceID: accountID,
@@ -45,12 +45,12 @@ func NewFileSync(accountID uint, remoteName string) *FileSync {
return result
}
// Updates multiple columns in the database.
// Updates mutates multiple columns on the existing row.
func (m *FileSync) Updates(values interface{}) error {
return UnscopedDb().Model(m).UpdateColumns(values).Error
}
// Update a column in the database.
// Update mutates a single column on the existing row.
func (m *FileSync) Update(attr string, value interface{}) error {
return UnscopedDb().Model(m).UpdateColumn(attr, value).Error
}