Skip to content

Commit

Permalink
additional fixes related to time
Browse files Browse the repository at this point in the history
  • Loading branch information
caffix committed Nov 9, 2024
1 parent ede77c5 commit 8f10465
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
4 changes: 2 additions & 2 deletions repository/edge.go
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ func (sql *sqlRepository) IncomingEdges(entity *types.Entity, since time.Time, l
if since.IsZero() {
result = sql.db.Where("to_entity_id = ?", entityId).Find(&edges)
} else {
result = sql.db.Where("to_entity_id = ? AND last_seen >= ?", entityId, since).Find(&edges)
result = sql.db.Where("to_entity_id = ? AND last_seen >= ?", entityId, since.UTC()).Find(&edges)
}
if err := result.Error; err != nil {
return nil, err
Expand Down Expand Up @@ -173,7 +173,7 @@ func (sql *sqlRepository) OutgoingEdges(entity *types.Entity, since time.Time, l
if since.IsZero() {
result = sql.db.Where("from_entity_id = ?", entityId).Find(&edges)
} else {
result = sql.db.Where("from_entity_id = ? AND last_seen >= ?", entityId, since).Find(&edges)
result = sql.db.Where("from_entity_id = ? AND last_seen >= ?", entityId, since.UTC()).Find(&edges)
}
if err := result.Error; err != nil {
return nil, err
Expand Down
6 changes: 3 additions & 3 deletions repository/entity.go
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ func (sql *sqlRepository) FindEntityByContent(assetData oam.Asset, since time.Ti
if since.IsZero() {
result = sql.db.Where("etype = ?", entity.Type).Find(&entities, jsonQuery)
} else {
result = sql.db.Where("etype = ? AND last_seen >= ?", entity.Type, since).Find(&entities, jsonQuery)
result = sql.db.Where("etype = ? AND last_seen >= ?", entity.Type, since.UTC()).Find(&entities, jsonQuery)
}
if result.Error != nil {
return []*types.Entity{}, result.Error
Expand Down Expand Up @@ -222,7 +222,7 @@ func (sql *sqlRepository) FindEntityById(id string, since time.Time) (*types.Ent
if since.IsZero() {
result = sql.db.First(&entity)
} else {
result = sql.db.Where("last_seen >= ?", since).First(&entity)
result = sql.db.Where("last_seen >= ?", since.UTC()).First(&entity)
}
if result.Error != nil {
return nil, result.Error
Expand Down Expand Up @@ -252,7 +252,7 @@ func (sql *sqlRepository) FindEntitiesByType(atype oam.AssetType, since time.Tim
if since.IsZero() {
result = sql.db.Where("etype = ?", atype).Find(&entities)
} else {
result = sql.db.Where("etype = ? AND last_seen >= ?", atype, since).Find(&entities)
result = sql.db.Where("etype = ? AND last_seen >= ?", atype, since.UTC()).Find(&entities)
}
if result.Error != nil {
return []*types.Entity{}, result.Error
Expand Down
8 changes: 4 additions & 4 deletions repository/tag.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ func (sql *sqlRepository) FindEntityTagById(id string, since time.Time) (*types.
if since.IsZero() {
result = sql.db.First(&tag)
} else {
result = sql.db.Where("last_seen >= ?", since).First(&tag)
result = sql.db.Where("last_seen >= ?", since.UTC()).First(&tag)
}
if result.Error != nil {
return nil, result.Error
Expand Down Expand Up @@ -113,7 +113,7 @@ func (sql *sqlRepository) GetEntityTags(entity *types.Entity, since time.Time, n
if since.IsZero() {
result = sql.db.Where("entity_id = ?", entityId).Find(&tags)
} else {
result = sql.db.Where("entity_id = ? AND last_seen >= ?", entityId, since).Find(&tags)
result = sql.db.Where("entity_id = ? AND last_seen >= ?", entityId, since.UTC()).Find(&tags)
}
if err := result.Error; err != nil {
return nil, err
Expand Down Expand Up @@ -236,7 +236,7 @@ func (sql *sqlRepository) FindEdgeTagById(id string, since time.Time) (*types.Ed
if since.IsZero() {
result = sql.db.First(&tag)
} else {
result = sql.db.Where("last_seen >= ?", since).First(&tag)
result = sql.db.Where("last_seen >= ?", since.UTC()).First(&tag)
}
if result.Error != nil {
return nil, result.Error
Expand Down Expand Up @@ -266,7 +266,7 @@ func (sql *sqlRepository) GetEdgeTags(edge *types.Edge, since time.Time, names .
if since.IsZero() {
result = sql.db.Where("edge_id = ?", edgeId).Find(&tags)
} else {
result = sql.db.Where("edge_id = ? AND last_seen >= ?", edgeId, since).Find(&tags)
result = sql.db.Where("edge_id = ? AND last_seen >= ?", edgeId, since.UTC()).Find(&tags)
}
if err := result.Error; err != nil {
return nil, err
Expand Down

0 comments on commit 8f10465

Please sign in to comment.