Documentation ¶
Index ¶
- Constants
- Variables
- func DefaultAddBookOptions() addBookOptions
- func DefaultAddFolderOptions() addFolderOptions
- func DefaultAddTagsOptions() addTagsOptions
- func DefaultListBooksOptions() listBooksOptions
- func DefaultListTagsOptions() listTagsOptions
- func DefaultRemoveBookOptions() removeBookOptions
- func DefaultRemoveFolderOptions() removeFolderOptions
- func DefaultRemoveTagsOptions() removeTagsOptions
- func DefaultUpdateBookOptions() updateBookOptions
- func DefaultUpdateFolderOptions() updateFolderOptions
- func ListTags(options listTagsOptions) ([]string, error)
- func PtrFromNullInt64(num NullInt64) *int64
- func PtrFromNullString(str NullString) *string
- func RemoveBook(id string, options removeBookOptions) (err error)
- func RemoveFolder(id string, options removeFolderOptions) error
- func UpdateConfig(update updateConfigFn) error
- type Book
- func AddBook(url string, options addBookOptions) (Book, error)
- func AddFolder(name string, options addFolderOptions) (Book, error)
- func AddTags(id string, tags []string, options addTagsOptions) (Book, error)
- func ListBooks(options listBooksOptions) ([]Book, error)
- func RemoveTags(id string, tags []string, options removeTagsOptions) (Book, error)
- func UpdateBook(id string, options updateBookOptions) (Book, error)
- func UpdateFolder(id string, options updateFolderOptions) (Book, error)
- type Config
- type Direction
- type NullInt64
- type NullString
- type Order
Constants ¶
const MaxDescriptionLength = 4096
const MaxNameLength = 2048
const MaxTagLength = 128
const MaxTags = 24
const MaxURLLength = 2048
const MinQueryLength = 3
Variables ¶
var ( // ErrNoUpdate is returned when an update is requested with no updates. ErrNoUpdate = errors.New("no update") // ErrBookNotFound is returned when a target bookmark was not found. ErrBookNotFound = errors.New("bookmark not found") // ErrFolderNotFound is returned when a target folder was not found. ErrFolderNotFound = errors.New("folder not found") // ErrTagNotFound is returned when a target tag was not found. ErrTagNotFound = errors.New("tag not found") // ErrURLTooShort is returned when a provided URL is too short. ErrURLTooShort = errors.New("URL too short") // ErrURLTooLong is too long when a provided URL is too long. ErrURLTooLong = errors.New("URL too long") // ErrNameTooShort is returned when a provided name is too short. ErrNameTooShort = errors.New("name too short") // ErrNameTooLong is returned when a provided name is too long. ErrNameTooLong = errors.New("name too long") // ErrDescriptionTooShort is returned when a provided description is too short. ErrDescriptionTooShort = errors.New("description too short") // ErrDescriptionTooLong is returned when a provided description is too long. ErrDescriptionTooLong = errors.New("description too long") // ErrTagTooShort is returned when a provided tag is too short. ErrTagTooShort = errors.New("tag too short") // ErrTagTooLong is returned when a provided tag is too long. ErrTagTooLong = errors.New("tag too long") // ErrDuplicateTag is returned when a tag is applied twice to a bookmark. ErrDuplicateTag = errors.New("tags must be unique") // ErrTooManyTags is returned when too many tags have been applied to bookmark. ErrTooManyTags = errors.New("too many tags") // ErrTagInvalidChar is returned when a provided tag has an invalid character. ErrTagInvalidChar = errors.New("tag had invalid chars") // ErrFirstTooSmall is returned when a provided first is too small. ErrFirstTooSmall = errors.New("first too small") // ErrInvalidOrder is returned when a provided order is invalid. ErrInvalidOrder = errors.New("invalid order") // ErrInvalidDirection is returned when a provided direction is invalid. ErrInvalidDirection = errors.New("invalid direction") // ErrQueryTooShort is returned when a provided query is too short. ErrQueryTooShort = errors.New("query too short") // ErrConfigMissing is returned when the config file is missing. ErrConfigMissing = errors.New("config missing") )
Functions ¶
func DefaultAddBookOptions ¶
func DefaultAddBookOptions() addBookOptions
DefaultAddBookOptions are the default options for AddBook.
func DefaultAddFolderOptions ¶
func DefaultAddFolderOptions() addFolderOptions
DefaultAddFolderOptions are the default options for AddFolder.
func DefaultAddTagsOptions ¶
func DefaultAddTagsOptions() addTagsOptions
DefaultAddTagsOptions are the default options for AddTags.
func DefaultListBooksOptions ¶
func DefaultListBooksOptions() listBooksOptions
DefaultListBooksOptions are the default options for ListBooks.
func DefaultListTagsOptions ¶
func DefaultListTagsOptions() listTagsOptions
DefaultListTagsOptions are the default options for ListTags.
func DefaultRemoveBookOptions ¶
func DefaultRemoveBookOptions() removeBookOptions
DefaultRemoveBookOptions are the default options for RemoveBook.
func DefaultRemoveFolderOptions ¶
func DefaultRemoveFolderOptions() removeFolderOptions
DefaultRemoveFolderOptions are the default options for RemoveFolder.
func DefaultRemoveTagsOptions ¶
func DefaultRemoveTagsOptions() removeTagsOptions
DefaultRemoveTagsOptions are the default options for RemoveTags.
func DefaultUpdateBookOptions ¶
func DefaultUpdateBookOptions() updateBookOptions
DefaultUpdateBookOptions are the default options for UpdateBook.
func DefaultUpdateFolderOptions ¶
func DefaultUpdateFolderOptions() updateFolderOptions
DefaultUpdateFolderOptions are the default options for UpdateFolder.
func PtrFromNullInt64 ¶
PtrFromNullInt64 converts a NullInt64 to a *int64. If the NullInt64 is not Valid nil is returned.
func PtrFromNullString ¶
func PtrFromNullString(str NullString) *string
PtrFromNullString converts a NullString to a *string. If the NullString is not Valid nil is returned.
func RemoveBook ¶
RemoveBook removes a bookmark from the bookmarks database.
func RemoveFolder ¶
RemoveFolder removes a folder from the bookmarks database.
func UpdateConfig ¶
func UpdateConfig(update updateConfigFn) error
UpdateConfig updates the current config. It will be created if it hasn't already been created.
Types ¶
type Book ¶
type Book struct { ID string // unique identifier of a bookmark/folder URL *string // address of a bookmark; not used for folders Name string // name of a bookmark/folder Description *string // description of a bookmark/folder ParentID *string // optional ID of the parent folder for a bookmark/folder IsFolder bool // true if folder, and false otherwise ParentName *string // name of parent folder if bookmark/folder has one Tags []string // tags applied to the bookmark }
Book is a bookmark or a folder.
func RemoveTags ¶
RemoveTags removes tags from a bookmark in the bookmarks database.
func UpdateBook ¶
UpdateBook updates a bookmark in the bookmarks database.
func UpdateFolder ¶
UpdateFolder updates a folder in the bookmarks database.
type NullInt64 ¶
type NullInt64 struct { sql.NullInt64 // allows use with sql/database and grants null support (null if Valid = false) Dirty bool // tracks if the argument has been provided at all (provided if Dirty = true) }
NullInt64 is an int64 that can be NULL.
func NullInt64From ¶
NullInt64From converts an int to a NullInt. If the int is zero it will be treated as null. The returned NullInt64 will have Dirty set to true.
func NullInt64FromPtr ¶
NullInt64FromPtr converts a *int64 to a NullInt64. If the int64 is nil it will be treated as null. The returned NullInt64 will have Dirty set to true.
func (NullInt64) MarshalJSON ¶
MarshalJSON marshalls a NullInt64 to JSON.
func (*NullInt64) UnmarshalJSON ¶
UnmarshalJSON unmarshalls a NullInt64 from JSON.
type NullString ¶
type NullString struct { sql.NullString // allows use with sql/database and grants null support (null if Valid = false) Dirty bool // tracks if the argument has been provided at all (provided if Dirty = true) }
NullString is a string that can be NULL.
func NullStringFrom ¶
func NullStringFrom(str string) NullString
NullStringFrom converts a string to a NullString. The returned NullString will have Dirty set to true.
func NullStringFromPtr ¶
func NullStringFromPtr(str *string) NullString
NullStringFromPtr converts a *string to a NullString. If the string is nil it will be treated as null. The returned NullString will have Dirty set to true.
func (NullString) MarshalJSON ¶
func (s NullString) MarshalJSON() ([]byte, error)
MarshalJSON marshalls a NullString to JSON.
func (*NullString) UnmarshalJSON ¶
func (s *NullString) UnmarshalJSON(data []byte) error
UnmarshalJSON unmarshalls a NullString from JSON.