本文整理汇总了Golang中github.com/APTrust/exchange/models.GenericFile.FindEventsByType方法的典型用法代码示例。如果您正苦于以下问题:Golang GenericFile.FindEventsByType方法的具体用法?Golang GenericFile.FindEventsByType怎么用?Golang GenericFile.FindEventsByType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/APTrust/exchange/models.GenericFile
的用法示例。
在下文中一共展示了GenericFile.FindEventsByType方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: markFileAsStored
func (storer *APTStorer) markFileAsStored(gf *models.GenericFile, sendWhere, storageUrl string) {
if sendWhere == "s3" {
gf.IngestStoredAt = time.Now().UTC()
gf.IngestStorageURL = storageUrl
gf.URI = storageUrl
events := gf.FindEventsByType(constants.EventIdentifierAssignment)
var event *models.PremisEvent
for i := range events {
existingEvent := events[i]
if strings.HasPrefix(existingEvent.OutcomeDetail, "http://") ||
strings.HasPrefix(existingEvent.OutcomeDetail, "https://") {
event = existingEvent
break
}
}
if event != nil {
event.DateTime = time.Now().UTC()
}
} else if sendWhere == "glacier" {
gf.IngestReplicatedAt = time.Now().UTC()
gf.IngestReplicationURL = storageUrl
events := gf.FindEventsByType(constants.EventReplication)
if events != nil && len(events) > 0 {
events[0].DateTime = time.Now().UTC()
}
}
}