models

package
v0.0.0-...-d0d6092 Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2016 License: LGPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Datastore

type Datastore interface {
	FlushErrors() error

	SearchBookmarks(string) []*types.Bookmark
	GetAllBookmarks() []*types.Bookmark
	GetBookmark(int) *types.Bookmark
	GetFolderBookmarks(int) []*types.Bookmark
	GetNoIconBookmarks() []*types.Bookmark
	GetStarredBookmarks() []*types.Bookmark
	SaveBookmark(*types.Bookmark) int64
	UpdateBookmark(*types.Bookmark)
	DeleteBookmark(*types.Bookmark)

	GetFolder(int) *types.Folder
	GetFolderSubfolders(int) []*types.Folder
	GetRootFolders() []*types.Folder
	SaveFolder(*types.Folder) int64
	UpdateFolder(*types.Folder)
	DeleteFolder(*types.Folder)
}

Datastore is a folders and bookmarks storage interface

type SQLiteDataStore

type SQLiteDataStore struct {
	*sql.DB
	// contains filtered or unexported fields
}

SQLiteDataStore implements the Datastore interface to store the folders and bookmarks in SQLite3.

func NewDBstore

func NewDBstore(dataSourceName string) (*SQLiteDataStore, error)

NewDBstore returns a database connection to the given dataSourceName ie. a path to the sqlite database file.

func (*SQLiteDataStore) CreateDatabase

func (db *SQLiteDataStore) CreateDatabase()

CreateDatabase creates the database tables.

func (*SQLiteDataStore) DeleteBookmark

func (db *SQLiteDataStore) DeleteBookmark(b *types.Bookmark)

DeleteBookmark delete the given Bookmark from the db

func (*SQLiteDataStore) DeleteFolder

func (db *SQLiteDataStore) DeleteFolder(f *types.Folder)

DeleteFolder delete the given Folder from the db.

func (*SQLiteDataStore) FlushErrors

func (db *SQLiteDataStore) FlushErrors() error

FlushErrors returns the last DB errors and flushes it.

func (*SQLiteDataStore) GetAllBookmarks

func (db *SQLiteDataStore) GetAllBookmarks() []*types.Bookmark

GetAllBookmarks returns all the bookmarks as an array of *Bookmark.

func (*SQLiteDataStore) GetBookmark

func (db *SQLiteDataStore) GetBookmark(id int) *types.Bookmark

GetBookmark returns a Bookmark instance with the given id.

func (*SQLiteDataStore) GetFolder

func (db *SQLiteDataStore) GetFolder(id int) *types.Folder

GetFolder returns a Folder instance with the given id.

func (*SQLiteDataStore) GetFolderBookmarks

func (db *SQLiteDataStore) GetFolderBookmarks(id int) []*types.Bookmark

GetFolderBookmarks returns the bookmarks of the given folder id.

func (*SQLiteDataStore) GetFolderSubfolders

func (db *SQLiteDataStore) GetFolderSubfolders(id int) []*types.Folder

GetFolderSubfolders returns the children folders as an array of *Folder

func (*SQLiteDataStore) GetNoIconBookmarks

func (db *SQLiteDataStore) GetNoIconBookmarks() []*types.Bookmark

GetNoIconBookmarks returns the bookmarks with no favicon.

func (*SQLiteDataStore) GetRootFolders

func (db *SQLiteDataStore) GetRootFolders() []*types.Folder

GetRootFolders returns the root folders as an array of *Folder

func (*SQLiteDataStore) GetStarredBookmarks

func (db *SQLiteDataStore) GetStarredBookmarks() []*types.Bookmark

GetStarredBookmarks returns the starred bookmarks.

func (*SQLiteDataStore) PopulateDatabase

func (db *SQLiteDataStore) PopulateDatabase()

PopulateDatabase populate the database with sample folders and bookmarks.

func (*SQLiteDataStore) SaveBookmark

func (db *SQLiteDataStore) SaveBookmark(b *types.Bookmark) int64

SaveBookmark saves the new given Bookmark into the db

func (*SQLiteDataStore) SaveFolder

func (db *SQLiteDataStore) SaveFolder(f *types.Folder) int64

SaveFolder saves the given new Folder into the db and returns the folder id. Called only on folder creation or rename so only the Title has to be set.

func (*SQLiteDataStore) SearchBookmarks

func (db *SQLiteDataStore) SearchBookmarks(s string) []*types.Bookmark

SearchBookmarks returns the bookmarks with the title containing the given string.

func (*SQLiteDataStore) UpdateBookmark

func (db *SQLiteDataStore) UpdateBookmark(b *types.Bookmark)

UpdateBookmark updates the given bookmark.

func (*SQLiteDataStore) UpdateFolder

func (db *SQLiteDataStore) UpdateFolder(f *types.Folder)

UpdateFolder updates the given folder.

Jump to

Keyboard shortcuts

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