better doc for interfaces
This commit is contained in:
parent
fc19fd867c
commit
816d63ea49
@ -7,9 +7,18 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
type DB interface {
|
type DB interface {
|
||||||
|
// Return nil if share does not exist
|
||||||
GetShare(ctx context.Context, slug string) (*types.Share, error)
|
GetShare(ctx context.Context, slug string) (*types.Share, error)
|
||||||
|
|
||||||
|
// Returns error if share already exists
|
||||||
CreateShare(ctx context.Context, share *types.Share) error
|
CreateShare(ctx context.Context, share *types.Share) error
|
||||||
|
|
||||||
|
// Returns error if share does not exist
|
||||||
DeleteShare(ctx context.Context, slug string) error
|
DeleteShare(ctx context.Context, slug string) error
|
||||||
|
|
||||||
|
// Returns all shares
|
||||||
GetAllShares(ctx context.Context) ([]*types.Share, error)
|
GetAllShares(ctx context.Context) ([]*types.Share, error)
|
||||||
|
|
||||||
|
// Close the database
|
||||||
Close() error
|
Close() error
|
||||||
}
|
}
|
||||||
|
@ -15,7 +15,12 @@ type ObjectReader interface {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type S3 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)
|
GetObject(ctx context.Context, key string) (ObjectReader, error)
|
||||||
|
|
||||||
|
// Check if the given key exists
|
||||||
KeyExists(ctx context.Context, key string) (bool, error)
|
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)
|
GetObjectMetadata(ctx context.Context, key string) (*types.Metadata, error)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user