25 lines
533 B
Go
25 lines
533 B
Go
package db
|
|
|
|
import (
|
|
"context"
|
|
|
|
"git.kapelle.org/niklas/s3share/internal/types"
|
|
)
|
|
|
|
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
|
|
}
|