From 816d63ea4920f377535fea03f3215d8278d70698 Mon Sep 17 00:00:00 2001 From: Djeeberjr Date: Wed, 1 Jun 2022 11:55:57 +0200 Subject: [PATCH] better doc for interfaces --- internal/db/db.go | 9 +++++++++ internal/s3/s3.go | 5 +++++ 2 files changed, 14 insertions(+) diff --git a/internal/db/db.go b/internal/db/db.go index 374732b..6296f0d 100644 --- a/internal/db/db.go +++ b/internal/db/db.go @@ -7,9 +7,18 @@ import ( ) type DB interface { + // Return nil if share does not exist GetShare(ctx context.Context, slug string) (*types.Share, error) + + // Returns error if share already exists CreateShare(ctx context.Context, share *types.Share) error + + // Returns error if share does not exist DeleteShare(ctx context.Context, slug string) error + + // Returns all shares GetAllShares(ctx context.Context) ([]*types.Share, error) + + // Close the database Close() error } diff --git a/internal/s3/s3.go b/internal/s3/s3.go index 7f1ac27..a06cc43 100644 --- a/internal/s3/s3.go +++ b/internal/s3/s3.go @@ -15,7 +15,12 @@ type ObjectReader interface { } type S3 interface { + // Get the object from the S3 bucket. Returns an error if the object does not exist. GetObject(ctx context.Context, key string) (ObjectReader, error) + + // Check if the given key exists KeyExists(ctx context.Context, key string) (bool, error) + + // Get object metadata. The `Filename` field is optional. Returns nil if the object does not exist. GetObjectMetadata(ctx context.Context, key string) (*types.Metadata, error) }