mirror of
https://github.com/lus/pasty.git
synced 2023-08-10 21:13:09 +03:00
restructure storage driver
This commit is contained in:
9
internal/pastes/paste.go
Normal file
9
internal/pastes/paste.go
Normal file
@@ -0,0 +1,9 @@
|
||||
package pastes
|
||||
|
||||
type Paste struct {
|
||||
ID string `json:"id"`
|
||||
Content string `json:"content"`
|
||||
ModificationToken string `json:"modificationToken,omitempty"`
|
||||
Created int64 `json:"created"`
|
||||
Metadata map[string]interface{} `json:"metadata"`
|
||||
}
|
||||
14
internal/pastes/repository.go
Normal file
14
internal/pastes/repository.go
Normal file
@@ -0,0 +1,14 @@
|
||||
package pastes
|
||||
|
||||
import (
|
||||
"context"
|
||||
"time"
|
||||
)
|
||||
|
||||
type Repository interface {
|
||||
ListIDs(ctx context.Context) ([]string, error)
|
||||
FindByID(ctx context.Context, id string) (*Paste, error)
|
||||
Upsert(ctx context.Context, paste *Paste) error
|
||||
DeleteByID(ctx context.Context, id string) error
|
||||
DeleteOlderThan(ctx context.Context, age time.Duration) (int, error)
|
||||
}
|
||||
Reference in New Issue
Block a user