shortcut

package
v0.0.0-...-61cb724 Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2024 License: BSD-3-Clause Imports: 6 Imported by: 0

Documentation

Overview

Package shortcut handles storing and retrieving shortcuts.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IDFromKeys

func IDFromKeys(s *Shortcut) string

IDFromKeys returns a unique ID for the set of keys found in the given Shortcut.

Types

type Shortcut

type Shortcut struct {
	Keys []string `json:"keys"`
}

Shortcut is a list of Trace ids, it is used in the Store interface.

type Store

type Store interface {
	// Insert adds the shortcut content into the database. The id of the
	// shortcut is returned.
	Insert(ctx context.Context, r io.Reader) (string, error)

	// InsertShortcut adds the shortcut content into the database. The id of the
	// shortcut is returned.
	InsertShortcut(ctx context.Context, shortcut *Shortcut) (string, error)

	// Get retrieves a parsed shortcut for the given id.
	Get(ctx context.Context, id string) (*Shortcut, error)

	// GetAll returns a channel that provides all the Shortcuts stored. This is
	// used to migrate between backends.
	GetAll(ctx context.Context) (<-chan *Shortcut, error)

	// DeleteShortcut deletes the shortcut from the table. Use with caution.
	DeleteShortcut(ctx context.Context, id string, tx pgx.Tx) error
}

Store is an interface for things that persists Shortcuts.

Directories

Path Synopsis
Package shortcuttest has common code for tests of implementations of shortcut.Store.
Package shortcuttest has common code for tests of implementations of shortcut.Store.
Package sqlshortcutstore implements shortcut.Store using an SQL database.
Package sqlshortcutstore implements shortcut.Store using an SQL database.

Jump to

Keyboard shortcuts

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