本文整理匯總了Golang中github.com/dropbox/changes-artifacts/database.Database.ListArtifactsInBucket方法的典型用法代碼示例。如果您正苦於以下問題:Golang Database.ListArtifactsInBucket方法的具體用法?Golang Database.ListArtifactsInBucket怎麽用?Golang Database.ListArtifactsInBucket使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/dropbox/changes-artifacts/database.Database
的用法示例。
在下文中一共展示了Database.ListArtifactsInBucket方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: ListArtifacts
func ListArtifacts(ctx context.Context, r render.Render, req *http.Request, db database.Database, bucket *model.Bucket) {
if bucket == nil {
LogAndRespondWithErrorf(ctx, r, http.StatusBadRequest, "No bucket specified")
return
}
artifacts, err := db.ListArtifactsInBucket(bucket.Id)
if err != nil {
LogAndRespondWithError(ctx, r, http.StatusInternalServerError, err)
return
}
r.JSON(http.StatusOK, artifacts)
}
示例2: ListArtifacts
func ListArtifacts(r render.Render, req *http.Request, db database.Database, params martini.Params, bucket *model.Bucket) {
if bucket == nil {
JsonErrorf(r, http.StatusBadRequest, "Error: no bucket specified")
return
}
artifacts, err := db.ListArtifactsInBucket(bucket.Id)
if err != nil {
JsonErrorf(r, http.StatusInternalServerError, "Error while listing artifacts: %s", err.Error())
return
}
r.JSON(http.StatusOK, artifacts)
}
示例3: CloseBucket
func CloseBucket(bucket *model.Bucket, db database.Database, s3Bucket *s3.Bucket, clk common.Clock) error {
if bucket.State != model.OPEN {
return fmt.Errorf("Bucket is already closed")
}
bucket.State = model.CLOSED
bucket.DateClosed = clk.Now()
if err := db.UpdateBucket(bucket); err != nil {
return err
}
if artifacts, err := db.ListArtifactsInBucket(bucket.Id); err != nil {
return err
} else {
for _, artifact := range artifacts {
if err := CloseArtifact(&artifact, db, s3Bucket, false); err != nil {
return err
}
}
}
return nil
}