26 lines
716 B
Go
26 lines
716 B
Go
package handler
|
|
|
|
import (
|
|
"context"
|
|
|
|
"5803025015/w04/internal/models"
|
|
)
|
|
|
|
type UserStore interface {
|
|
Create(ctx context.Context, user *models.User) error
|
|
GetByUsername(ctx context.Context, username string) (*models.User, error)
|
|
}
|
|
|
|
type SessionStore interface {
|
|
Create(ctx context.Context, session *models.Session) error
|
|
Get(ctx context.Context, token string) (*models.Session, error)
|
|
Delete(ctx context.Context, token string) error
|
|
}
|
|
|
|
type SnippetStore interface {
|
|
Create(ctx context.Context, s *models.Snippet) error
|
|
GetByID(ctx context.Context, id string) (*models.Snippet, error)
|
|
ListByOwner(ctx context.Context, ownerID string) ([]*models.Snippet, error)
|
|
Delete(ctx context.Context, id string) error
|
|
}
|