Version: v0.0.0-...-25250c4 Latest Latest

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

Go to latest
Published: Jan 7, 2020 License: BSD-2-Clause Imports: 17 Imported by: 0




This section is empty.


This section is empty.


This section is empty.


type StoragePostgres

type StoragePostgres struct {
	// contains filtered or unexported fields

Implements storage.Storage

func New

func New(postgresURL string) (*StoragePostgres, error)

func (*StoragePostgres) ApplyMigrations

func (s *StoragePostgres) ApplyMigrations() error

func (*StoragePostgres) CheckIntegrity

func (s *StoragePostgres) CheckIntegrity() error

func (*StoragePostgres) Connect

func (s *StoragePostgres) Connect() error

func (*StoragePostgres) CreateBookmark

func (s *StoragePostgres) CreateBookmark(tx *sql.Tx, bd *storage.BookmarkData) (bkmID int, err error)

func (*StoragePostgres) CreateGoogleUser

func (s *StoragePostgres) CreateGoogleUser(
	tx *sql.Tx, userID int, googleUserID, email string,
) error

func (*StoragePostgres) CreateTag

func (s *StoragePostgres) CreateTag(
	tx *sql.Tx, td *storage.TagData,
) (tagID int, err error)

func (*StoragePostgres) CreateTaggable

func (s *StoragePostgres) CreateTaggable(tx *sql.Tx, tgbd *storage.TaggableData) (tgbID int, err error)

func (*StoragePostgres) CreateUser

func (s *StoragePostgres) CreateUser(
	tx *sql.Tx, ud *storage.UserData,
) (userID int, err error)

func (*StoragePostgres) DeleteTag

func (s *StoragePostgres) DeleteTag(
	tx *sql.Tx, tagID int, leafPolicy storage.TaggableLeafPolicy,
) (err error)

func (*StoragePostgres) DeleteTaggable

func (s *StoragePostgres) DeleteTaggable(tx *sql.Tx, taggableID int) error

func (*StoragePostgres) DeleteUser

func (s *StoragePostgres) DeleteUser(tx *sql.Tx, userID int) error

func (*StoragePostgres) GetAccessToken

func (s *StoragePostgres) GetAccessToken(
	tx *sql.Tx, userID int, descr string, createIfNotExist bool,
) (token string, err error)

func (*StoragePostgres) GetBookmarkByID

func (s *StoragePostgres) GetBookmarkByID(
	tx *sql.Tx, bookmarkID int, tagsFetchOpts *storage.TagsFetchOpts,
) (bookmark *storage.BookmarkDataWTags, err error)

func (*StoragePostgres) GetBookmarksByURL

func (s *StoragePostgres) GetBookmarksByURL(
	tx *sql.Tx, url string, ownerID int, tagsFetchOpts *storage.TagsFetchOpts,
) (bookmarks []storage.BookmarkDataWTags, err error)

func (*StoragePostgres) GetRootTagID

func (s *StoragePostgres) GetRootTagID(tx *sql.Tx, ownerID int) (int, error)

GetRootTagID returns the id of the root tag for the given user.

func (*StoragePostgres) GetTag

func (s *StoragePostgres) GetTag(
	tx *sql.Tx, tagID int, opts *storage.GetTagOpts,
) (*storage.TagData, error)

func (*StoragePostgres) GetTagIDByName

func (s *StoragePostgres) GetTagIDByName(
	tx *sql.Tx, parentTagID int, tagName string,
) (int, error)

func (*StoragePostgres) GetTagIDByPath

func (s *StoragePostgres) GetTagIDByPath(tx *sql.Tx, ownerID int, tagPath string) (int, error)

func (*StoragePostgres) GetTagNames

func (s *StoragePostgres) GetTagNames(tx *sql.Tx, tagID int) ([]string, error)

func (*StoragePostgres) GetTaggedBookmarks

func (s *StoragePostgres) GetTaggedBookmarks(
	tx *sql.Tx, tagIDs []int, ownerID *int, tagsFetchOpts *storage.TagsFetchOpts,
) (bookmarks []storage.BookmarkDataWTags, err error)

func (*StoragePostgres) GetTaggedTaggableIDs

func (s *StoragePostgres) GetTaggedTaggableIDs(
	tx *sql.Tx, tagIDs []int, ownerID *int, ttypes []storage.TaggableType,
) (taggableIDs []int, err error)

func (*StoragePostgres) GetTaggings

func (s *StoragePostgres) GetTaggings(
	tx *sql.Tx, taggableID int, tm storage.TaggingMode,
) (tagIDs []int, err error)

func (*StoragePostgres) GetTags

func (s *StoragePostgres) GetTags(
	tx *sql.Tx, parentTagID int, opts *storage.GetTagOpts,
) ([]storage.TagData, error)

func (*StoragePostgres) GetUser

func (s *StoragePostgres) GetUser(
	tx *sql.Tx, args *storage.GetUserArgs,
) (*storage.UserData, error)

func (*StoragePostgres) GetUserByAccessToken

func (s *StoragePostgres) GetUserByAccessToken(
	tx *sql.Tx, token string,
) (*storage.UserData, error)

func (*StoragePostgres) GetUserByGoogleUserID

func (s *StoragePostgres) GetUserByGoogleUserID(
	tx *sql.Tx, googleUserID string,
) (*storage.UserData, error)

func (*StoragePostgres) GetUsers

func (s *StoragePostgres) GetUsers(tx *sql.Tx) ([]storage.UserData, error)

func (*StoragePostgres) SetTaggings

func (s *StoragePostgres) SetTaggings(
	tx *sql.Tx, taggableID int, tagIDs []int, tm storage.TaggingMode,
) (err error)

func (*StoragePostgres) Tx

func (s *StoragePostgres) Tx(fn func(*sql.Tx) error) error

func (*StoragePostgres) TxOpt

func (s *StoragePostgres) TxOpt(
	ilevel storage.TxILevel, mode storage.TxMode, fn func(*sql.Tx) error,
) error

func (*StoragePostgres) UpdateBookmark

func (s *StoragePostgres) UpdateBookmark(tx *sql.Tx, bd *storage.BookmarkData) (err error)

func (*StoragePostgres) UpdateTag

func (s *StoragePostgres) UpdateTag(
	tx *sql.Tx, td *storage.TagData, leafPolicy storage.TaggableLeafPolicy,
) (err error)


Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL