本文整理汇总了Golang中github.com/APTrust/exchange/models.GenericFile.URI方法的典型用法代码示例。如果您正苦于以下问题:Golang GenericFile.URI方法的具体用法?Golang GenericFile.URI怎么用?Golang GenericFile.URI使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/APTrust/exchange/models.GenericFile
的用法示例。
在下文中一共展示了GenericFile.URI方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: TestPreservationStorageFileName
func TestPreservationStorageFileName(t *testing.T) {
genericFile := models.GenericFile{}
genericFile.URI = ""
fileName, err := genericFile.PreservationStorageFileName()
if err == nil {
t.Errorf("PreservationStorageFileName() should have returned an error")
}
genericFile.URI = "https://s3.amazonaws.com/aptrust.test.preservation/a58a7c00-392f-11e4-916c-0800200c9a66"
fileName, err = genericFile.PreservationStorageFileName()
if err != nil {
t.Errorf("PreservationStorageFileName() returned an error: %v", err)
return
}
assert.Equal(t, "a58a7c00-392f-11e4-916c-0800200c9a66", fileName)
}
示例2: 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()
}
}
}