bukudb

package
v1.0.7 Latest Latest
Warning

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

Go to latest
Published: Oct 9, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

bukudb, for use with https://github.com/jarun/Buku

Index

Constants

View Source
const MaxBookmarks = 1000

MaxBookmarks defines the maximum number of bookmarks that can be stored.

Variables

This section is empty.

Functions

This section is empty.

Types

type Bookmark

type Bookmark struct {
	// ID is the unique identifier for the bookmark.
	ID uint16

	// URL of the bookmark.
	URL string

	// Title (metadata) of the bookmark.
	Title string

	// Tags associated with the bookmark.
	Tags []string

	// Comment or description of the bookmark.
	Comment string
}

Bookmark represents a single bookmark entry.

type BukuDB

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

BukuDB represents a connection to the buku SQLite database.

func NewBukuDB

func NewBukuDB(dbPath string) (*BukuDB, error)

NewBukuDB initializes and returns a new BukuDB instance.

func (*BukuDB) Add

func (db *BukuDB) Add(bookmark Bookmark) error

Add inserts a new bookmark into the database.

func (*BukuDB) AddTags

func (db *BukuDB) AddTags(id uint16, tags []string) error

AddTags adds tags to the bookmark with the given ID.

func (*BukuDB) ClearTags

func (db *BukuDB) ClearTags(id uint16) error

ClearTags removes all tags from the bookmark with the given ID.

func (*BukuDB) Close

func (db *BukuDB) Close() error

Close closes the database connection.

func (*BukuDB) Get

func (db *BukuDB) Get(id uint16) (Bookmark, error)

Get returns a bookmark by ID.

func (*BukuDB) GetAll

func (db *BukuDB) GetAll() ([]Bookmark, error)

GetAll returns a all bookmarks in db.

func (*BukuDB) Len

func (db *BukuDB) Len() int

Len returns the number of bookmarks in db.

func (*BukuDB) Remove

func (db *BukuDB) Remove(id uint16) error

Remove removes a bookmark from the database.

func (*BukuDB) RemoveTags

func (db *BukuDB) RemoveTags(id uint16, tags []string) error

RemoveTags removes tags from the bookmark with the given ID.

func (*BukuDB) UpdateComment

func (db *BukuDB) UpdateComment(id uint16, comment string) error

UpdateComment updates the comment of the bookmark with the given ID.

func (*BukuDB) UpdateTitle

func (db *BukuDB) UpdateTitle(id uint16, title string) error

UpdateTitle updates the title of the bookmark with the given ID.

func (*BukuDB) UpdateURL

func (db *BukuDB) UpdateURL(id uint16, url string) error

UpdateURL updates the URL of the bookmark with the given ID.

type DBInterface added in v1.0.7

type DBInterface interface {
	Close() error
	Len() int
	GetAll() ([]Bookmark, error)
	Get(id uint16) (Bookmark, error)
	Add(bookmark Bookmark) error
	UpdateTitle(id uint16, title string) error
	UpdateURL(id uint16, url string) error
	UpdateComment(id uint16, comment string) error
	AddTags(id uint16, tags []string) error
	RemoveTags(id uint16, tags []string) error
	ClearTags(id uint16) error
	Remove(id uint16) error
}

Jump to

Keyboard shortcuts

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