Documentation ¶
Index ¶
- Constants
- Variables
- func CleanupTagName(s string, allowEmpty bool) (err error, name string)
- func ValidateTagName(name string, allowEmpty bool) error
- type BookmarkData
- type BookmarkDataWTags
- type BookmarkTagPath
- type BookmarkTagPathItem
- type GetTagOpts
- type GetUserArgs
- type Storage
- type TagData
- type TagNamesFetchMode
- type TaggableData
- type TaggableLeafPolicy
- type TaggableType
- type TaggingMode
- type TagsFetchMode
- type TagsFetchOpts
- type TxILevel
- type TxMode
- type UserData
Constants ¶
View Source
const ( TaggableTypeBookmark TaggableType = "bookmark" TagsFetchModeNone TagsFetchMode = "none" TagsFetchModeLeafs TagsFetchMode = "leafs" TagsFetchModeAll TagsFetchMode = "all" TagsFetchModeDefault = TagsFetchModeLeafs TagNamesFetchModeNone TagNamesFetchMode = "none" TagNamesFetchModeFull TagNamesFetchMode = "full" TagNamesFetchModeDefault = TagNamesFetchModeFull TaggableLeafPolicyKeep TaggableLeafPolicy = "keep_new_leaf" TaggableLeafPolicyDel TaggableLeafPolicy = "del_new_leaf" )
Variables ¶
Functions ¶
func ValidateTagName ¶
Types ¶
type BookmarkData ¶
type BookmarkDataWTags ¶
type BookmarkDataWTags struct { BookmarkData Tags []BookmarkTagPath }
type BookmarkTagPath ¶
type BookmarkTagPath struct {
TagItems []BookmarkTagPathItem
}
type BookmarkTagPathItem ¶
type GetTagOpts ¶
type GetTagOpts struct { GetNames bool }
type GetUserArgs ¶
Either ID or Username should be given.
type Storage ¶
type Storage interface { //-- Common Connect() error ApplyMigrations() error Tx(fn func(*sql.Tx) error) error TxOpt(ilevel TxILevel, mode TxMode, fn func(*sql.Tx) error) error //-- Users GetUser(tx *sql.Tx, args *GetUserArgs) (*UserData, error) CreateUser(tx *sql.Tx, ud *UserData) (userID int, err error) DeleteUser(tx *sql.Tx, userID int) error GetUsers(tx *sql.Tx) ([]UserData, error) GetAccessToken( tx *sql.Tx, userID int, descr string, createIfNotExist bool, ) (token string, err error) GetUserByAccessToken(tx *sql.Tx, token string) (*UserData, error) GetUserByGoogleUserID(tx *sql.Tx, googleUserID string) (*UserData, error) CreateGoogleUser(tx *sql.Tx, userID int, googleUserID, email string) error //-- Tags CreateTag(tx *sql.Tx, td *TagData) (tagID int, err error) // leafPolicy is used if only td.ParentTagID is not nil, i.e. if the tag // should be moved. UpdateTag(tx *sql.Tx, td *TagData, leafPolicy TaggableLeafPolicy) (err error) DeleteTag(tx *sql.Tx, tagID int, leafPolicy TaggableLeafPolicy) (err error) GetTagIDByPath(tx *sql.Tx, ownerID int, tagPath string) (int, error) GetTagIDByName(tx *sql.Tx, parentTagID int, tagName string) (int, error) GetRootTagID(tx *sql.Tx, ownerID int) (int, error) // NOTE: all non-slice pointer fields are guaranteed to be non-nil GetTag(tx *sql.Tx, tagID int, opts *GetTagOpts) (*TagData, error) GetTags( tx *sql.Tx, parentTagID int, opts *GetTagOpts, ) ([]TagData, error) GetTagNames(tx *sql.Tx, tagID int) ([]string, error) //-- Taggables (bookmarks) CreateTaggable(tx *sql.Tx, tgbd *TaggableData) (tgbID int, err error) CreateBookmark(tx *sql.Tx, bd *BookmarkData) (bkmID int, err error) UpdateBookmark(tx *sql.Tx, bd *BookmarkData) (err error) GetTaggedTaggableIDs( tx *sql.Tx, tagIDs []int, ownerID *int, ttypes []TaggableType, ) (taggableIDs []int, err error) // tagsFetchOpts might be nil, or any of the options might be empty strings: // in this case, defaults will be used: TagsFetchModeLeafs and // TagNamesFetchModeFull. GetTaggedBookmarks( tx *sql.Tx, tagIDs []int, ownerID *int, tagsFetchOpts *TagsFetchOpts, ) (bookmarks []BookmarkDataWTags, err error) GetBookmarksByURL( tx *sql.Tx, url string, ownerID int, tagsFetchOpts *TagsFetchOpts, ) (bookmarks []BookmarkDataWTags, err error) GetBookmarkByID( tx *sql.Tx, bookmarkID int, tagsFetchOpts *TagsFetchOpts, ) (bookmark *BookmarkDataWTags, err error) DeleteTaggable(tx *sql.Tx, taggableID int) error //-- Taggings GetTaggings( tx *sql.Tx, taggableID int, tm TaggingMode, ) (tagIDs []int, err error) SetTaggings( tx *sql.Tx, taggableID int, tagIDs []int, tm TaggingMode, ) error //-- Maintenance CheckIntegrity() error }
type TagNamesFetchMode ¶
type TagNamesFetchMode string
type TaggableData ¶
type TaggableData struct { ID int OwnerID int Type TaggableType CreatedAt uint64 UpdatedAt uint64 }
type TaggableLeafPolicy ¶
type TaggableLeafPolicy string
Taggable leaf policy when tags structure changes: either keep the taggings of the new leaf, or delete it
type TaggableType ¶
type TaggableType string
type TaggingMode ¶
type TaggingMode int
TaggingMode is used for GetTaggings(), SetTaggings: specifies whether given argument/returned value should contain all tags (including all supertags), or leafs only.
const ( TaggingModeAll TaggingMode = iota TaggingModeLeafs )
type TagsFetchMode ¶
type TagsFetchMode string
type TagsFetchOpts ¶
type TagsFetchOpts struct { TagsFetchMode TagsFetchMode TagNamesFetchMode TagNamesFetchMode }
Click to show internal directories.
Click to hide internal directories.