Documentation ¶
Index ¶
Constants ¶
View Source
const ( COMMAND = "Commands" CODE = "Code snippets" BOOKMARK = "Bookmarks" SNIP = "SNIP" )
Variables ¶
View Source
var ErrEditCanceled = errors.New("edit canceled")
View Source
var ErrExecCanceled = errors.New("execution canceled")
View Source
var ErrNotExecutable = errors.New("not executable")
Functions ¶
This section is empty.
Types ¶
type Bookmark ¶
type Bookmark struct {
// contains filtered or unexported fields
}
func NewBookmark ¶
func (*Bookmark) Data ¶
func (b *Bookmark) Data() *SnippetData
func (*Bookmark) Type ¶
func (b *Bookmark) Type() SnippetType
type Code ¶
type Code struct {
// contains filtered or unexported fields
}
func (*Code) Data ¶
func (c *Code) Data() *SnippetData
func (*Code) Type ¶
func (c *Code) Type() SnippetType
type Command ¶
type Command struct {
// contains filtered or unexported fields
}
func NewCommand ¶
func (*Command) Data ¶
func (cmd *Command) Data() *SnippetData
func (*Command) Type ¶
func (cmd *Command) Type() SnippetType
type Filters ¶
type Filters struct { Type SnippetType Language string Tags string }
Filters are used to filter the snippets list
type Repository ¶
type Repository struct {
// contains filtered or unexported fields
}
Repository is the main accessor for snippets in the DB
func NewRepository ¶
func NewRepository() *Repository
NewRepository returns a new snippet resository
func (*Repository) FindWithFilters ¶
func (r *Repository) FindWithFilters(filters Filters) []Snippet
FindWithFilters returns snippets that match the given filters
func (*Repository) Get ¶
func (r *Repository) Get(id int) Snippet
Get returns a snippet with the given ID
func (*Repository) Save ¶
func (r *Repository) Save(s Snippet)
Save an existing snippet to the database
type Snippet ¶
type Snippet interface { Type() SnippetType Data() *SnippetData Execute() error Edit() error String() string }
func New ¶
func New(sd SnippetData) Snippet
type SnippetData ¶
type SnippetData struct { ID int64 Content string Description string Tags string Type SnippetType Language string }
SnippetData contains the data for one snippet
type SnippetType ¶
type SnippetType string
Click to show internal directories.
Click to hide internal directories.