s3-share/internal/db/db.go

25 lines
533 B
Go
Raw Permalink Normal View History

2022-05-09 12:52:18 +00:00
package db
import (
"context"
"git.kapelle.org/niklas/s3share/internal/types"
)
type DB interface {
2022-06-01 09:55:57 +00:00
// Return nil if share does not exist
2022-05-09 12:52:18 +00:00
GetShare(ctx context.Context, slug string) (*types.Share, error)
2022-06-01 09:55:57 +00:00
// Returns error if share already exists
2022-05-09 12:52:18 +00:00
CreateShare(ctx context.Context, share *types.Share) error
2022-06-01 09:55:57 +00:00
// Returns error if share does not exist
2022-05-09 12:52:18 +00:00
DeleteShare(ctx context.Context, slug string) error
2022-06-01 09:55:57 +00:00
// Returns all shares
2022-05-14 21:25:50 +00:00
GetAllShares(ctx context.Context) ([]*types.Share, error)
2022-06-01 09:55:57 +00:00
// Close the database
2022-05-09 12:52:18 +00:00
Close() error
}