Versions in this module Expand all Collapse all v1 v1.3.0 Nov 21, 2020 Changes in this version + const DefaultURLTitle + var ErrDatabaseAlreadyOpen = errors.New("database is already open") + var ErrDuplicateKey = errors.New("duplicate key") + var ErrNotFound = errors.New("object not found") + var ErrSettingsExists = errors.New("settings object already exists") + var ErrUserExists = errors.New("user already exists") + func BackupHandler(w http.ResponseWriter, req *http.Request) error + func CreatePageIndexes(perPage int) error + func DBWithLock(fn func(*bolt.DB)) + func DeleteAPITokens() error + func DeleteURL(url *URL) error + func HACKCreatePageIndexes(perPage int, tx *bolt.Tx) error + func MustInit(cfg *config.Config) + func NewPageIndexPaginator(page int) (*pageIndexPaginator, error) + func NewQuery(q string) *query + func RunWithBucketForType(tx *bolt.Tx, m interface{}, fn func(*bolt.Bucket) error) error + type APIToken struct + CreatedAt time.Time + ID uuid.UUID + Token uuid.UUID + UpdatedAt time.Time + func CreateAPIToken() (*APIToken, error) + func GetAPIToken() (*APIToken, error) + type AllURLGetter struct + func (AllURLGetter) GetURLs(tx *bolt.Tx) ([]*URL, error) + type CreateTagOptions struct + Name string + type CreateURLOptions struct + Private bool + Tags string + URL string + type FavURLGetter struct + func (FavURLGetter) GetURLs(tx *bolt.Tx) ([]*URL, error) + type HTTPMetadataFetcher struct + func (HTTPMetadataFetcher) FetchMetadata(url string) (PageMeta, error) + type InitializeInstanceOptions struct + Email string + EmbedPhotos bool + EmbedVideos bool + Password string + PerPage int + Private bool + type PageIndex struct + PerPage int + TotalPages int + URLIDs []uuid.UUID + URLs []*URL + func GetPageIndexByPage(page int) (*PageIndex, error) + func GetPageIndexes() ([]*PageIndex, error) + type PageMeta struct + Status int + Title string + type Paginator interface + CurrentPage func() int + HasNext func() bool + HasPagination func() bool + HasPrevious func() bool + NextPage func() int + Pages func() []int + PreviousPage func() int + TotalPages func() int + URLs func() []*URL + type PinnedTag struct + Ordinal int + Tag *Tag + TagID uuid.UUID + type PinnedTags []PinnedTag + func GetPinnedTags() (*PinnedTags, error) + func PinTag(tag *Tag) (*PinnedTags, error) + func UnpinTag(tag *Tag) (*PinnedTags, error) + type SearchURLGetter struct + func NewSearchURLGetter(query string) *SearchURLGetter + func (s SearchURLGetter) GetURLs(tx *bolt.Tx) ([]*URL, error) + type Settings struct + CreatedAt time.Time + EmbedPhotos bool + EmbedVideos bool + PerPage int + Private bool + UpdatedAt time.Time + func GetSettings() (*Settings, error) + func SaveSettings(opts SettingsOptions) (*Settings, error) + type SettingsOptions struct + EmbedPhotos bool + EmbedVideos bool + PerPage int + Private bool + type SufrDB struct + func New(path string) (*SufrDB, error) + func (s *SufrDB) Close() + func (s *SufrDB) Open() error + func (s *SufrDB) Statsdumper() + type Tag struct + CreatedAt time.Time + ID uuid.UUID + Name string + URLIDs []uuid.UUID + URLs []*URL + UpdatedAt time.Time + func CreateTag(opts CreateTagOptions) (*Tag, error) + func GetTag(id uuid.UUID) (*Tag, error) + func (t *Tag) AddURL(url *URL, tx *bolt.Tx) error + func (t *Tag) GetURLs(_ *bolt.Tx) ([]*URL, error) + type URL struct + CreatedAt time.Time + Favorite bool + ID uuid.UUID + Notes string + Private bool + StatusCode int + TagIDs []uuid.UUID + Tags []*Tag + Title string + URL string + UpdatedAt time.Time + func CreateURL(opts CreateURLOptions, fetcher URLMetadataFetcher) (*URL, error) + func GetURL(id uuid.UUID) (*URL, error) + func GetURLByURL(urlstr string) (*URL, error) + func GetURLs() ([]*URL, error) + func UpdateURL(opts UpdateURLOptions) (*URL, error) + func (u *URL) FormattedCreatedAt() string + func (u *URL) GetTagsForDisplay() string + func (u *URL) HasTags() bool + func (u *URL) IsPublic() bool + func (u *URL) NotesHTML() template.HTML + func (u *URL) ToggleFavorite() error + type URLMetadataFetcher interface + FetchMetadata func(string) (PageMeta, error) + type URLPaginator struct + URLs []*URL + func NewURLPaginator(page, perPage, pagePadding int, getter urlGetter) (*URLPaginator, error) + func (p URLPaginator) CurrentPage() int + func (p URLPaginator) HasNext() bool + func (p URLPaginator) HasPagination() bool + func (p URLPaginator) HasPrevious() bool + func (p URLPaginator) NextPage() int + func (p URLPaginator) Pages() []int + func (p URLPaginator) PreviousPage() int + func (p URLPaginator) TotalPages() int + type URLsByDateDesc []*URL + func (u URLsByDateDesc) Len() int + func (u URLsByDateDesc) Less(i, j int) bool + func (u URLsByDateDesc) Swap(i, j int) + type UpdateURLOptions struct + ID uuid.UUID + Notes string + Private bool + Tags string + Title string + type User struct + CreatedAt time.Time + Email string + ID uuid.UUID + Password string + UpdatedAt time.Time + func CreateUser(opts UserOptions) (*User, error) + func GetUser() (*User, error) + type UserOptions struct + Email string + Password string + type Version struct + Version uint + func CreateVersion(start uint, tx *bolt.Tx) (*Version, error) + func GetVersion(tx *bolt.Tx) (*Version, error) + func (v *Version) Increment(tx *bolt.Tx) error