Documentation
¶
Index ¶
- func HashToken(token string) string
- type Document
- type DocumentSummary
- type Store
- func (s *Store) Create(content, tokenHash, ipHash string) (string, error)
- func (s *Store) Delete(id, tokenHash string) (bool, error)
- func (s *Store) GenerateID(length int) (string, error)
- func (s *Store) GetByID(id string) (*Document, error)
- func (s *Store) ListByTokenHash(tokenHash string) ([]DocumentSummary, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type DocumentSummary ¶ added in v0.3.0
DocumentSummary represents the dashboard list view of a document.
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store wraps the SQLite database.
func (*Store) Delete ¶
Delete removes a document if the tokenHash matches. Returns true if a row was deleted, false if not found or token mismatch.
func (*Store) GenerateID ¶
GenerateID returns a unique Base62 ID of the given length. It retries on collision (extremely rare with 4+ chars).
func (*Store) ListByTokenHash ¶ added in v0.3.0
func (s *Store) ListByTokenHash(tokenHash string) ([]DocumentSummary, error)
ListByTokenHash returns all documents owned by the token hash, newest first.
Click to show internal directories.
Click to hide internal directories.