Better naming, distingiush between "service" and "backend"

This commit is contained in:
Philipp Wolfer 2023-11-19 22:54:42 +01:00
parent 6e330daf06
commit 8b227cb514
No known key found for this signature in database
GPG key ID: 8FDF744D4919943B
5 changed files with 20 additions and 20 deletions

View file

@ -58,23 +58,23 @@ func New(dsn string) (db Database, err error) {
func (db Database) GetImportTimestamp(source string, target string, entity string) (time.Time, error) {
result := ImportTimestamp{
SourceBackend: source,
TargetBackend: target,
SourceService: source,
TargetService: target,
Entity: entity,
}
db.db.Limit(1).Find(&result)
return result.Timestamp, nil
err := db.db.Limit(1).Find(&result).Error
return result.Timestamp, err
}
func (db Database) SetImportTimestamp(source string, target string, entity string, timestamp time.Time) error {
entry := ImportTimestamp{
SourceBackend: source,
TargetBackend: target,
SourceService: source,
TargetService: target,
Entity: entity,
Timestamp: timestamp,
}
db.db.Clauses(clause.OnConflict{
err := db.db.Clauses(clause.OnConflict{
DoUpdates: clause.AssignmentColumns([]string{"timestamp", "updated_at"}),
}).Create(&entry)
return nil
}).Create(&entry).Error
return err
}