store

package
v1.0.8 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 26, 2026 License: 0BSD Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BoltStore

type BoltStore struct {
	// contains filtered or unexported fields
}

func NewBoltStore

func NewBoltStore(path string, opts *bbolt.Options) (*BoltStore, error)

func (*BoltStore) Cleanup

func (s *BoltStore) Cleanup(maxAge time.Duration)

func (*BoltStore) Close

func (s *BoltStore) Close() error

func (*BoltStore) Del

func (s *BoltStore) Del(id string) error

func (*BoltStore) Get

func (s *BoltStore) Get(id string) (*Paste, bool, error)

func (*BoltStore) GetIDByHash

func (s *BoltStore) GetIDByHash(hash string) (string, bool, error)

func (*BoltStore) Set

func (s *BoltStore) Set(id, hash, content string, metadata map[string]interface{}) error

type MemoryStore

type MemoryStore struct {
	// contains filtered or unexported fields
}

func NewMemoryStore

func NewMemoryStore() *MemoryStore

func (*MemoryStore) Del

func (s *MemoryStore) Del(id string) error

func (*MemoryStore) Get

func (s *MemoryStore) Get(id string) (*Paste, bool, error)

func (*MemoryStore) GetIDByHash

func (s *MemoryStore) GetIDByHash(hash string) (string, bool, error)

func (*MemoryStore) Set

func (s *MemoryStore) Set(id, hash, content string, metadata map[string]interface{}) error

type Paste

type Paste struct {
	Content   string                 `json:"content"`
	CreatedAt time.Time              `json:"createdAt"`
	Hash      string                 `json:"hash,omitempty"`
	Metadata  map[string]interface{} `json:"metadata,omitempty"`
}

type Store

type Store interface {
	Get(id string) (*Paste, bool, error)
	GetIDByHash(hash string) (string, bool, error)
	Set(id, hash, content string, metadata map[string]interface{}) error
	Del(id string) error
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL