postgresql

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Jan 26, 2024 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DBBookmark

type DBBookmark struct {
	UID      string `db:"uid"`
	UserUUID string `db:"user_uuid"`

	URL         string `db:"url"`
	Title       string `db:"title"`
	Description string `db:"description"`

	Private bool     `db:"private"`
	Tags    []string `db:"tags"`

	FullTextSearchString string `db:"fulltextsearch_string"`

	CreatedAt time.Time `db:"created_at"`
	UpdatedAt time.Time `db:"updated_at"`
}

type DBSession

type DBSession struct {
	UserUUID               string    `db:"user_uuid"`
	RememberTokenHash      string    `db:"remember_token_hash"`
	RememberTokenExpiresAt time.Time `db:"remember_token_expires_at"`
}

type DBTag

type DBTag struct {
	Name  string `db:"name"`
	Count uint   `db:"count"`
}

type DBUser

type DBUser struct {
	UUID         string `db:"uuid"`
	Email        string `db:"email"`
	NickName     string `db:"nick_name"`
	DisplayName  string `db:"display_name"`
	PasswordHash string `db:"password_hash"`
	IsAdmin      bool   `db:"is_admin"`

	CreatedAt time.Time `db:"created_at"`
	UpdatedAt time.Time `db:"updated_at"`
}

type Repository

type Repository struct {
	// contains filtered or unexported fields
}

Repository provides a PostgreSQL persistence layer.

func NewRepository

func NewRepository(pool *pgxpool.Pool) *Repository

NewRepository initializes and returns a PostgreSQL Repository.

func (*Repository) BookmarkAdd

func (r *Repository) BookmarkAdd(b bookmark.Bookmark) error

func (*Repository) BookmarkAddMany

func (r *Repository) BookmarkAddMany(bookmarks []bookmark.Bookmark) (int64, error)

func (*Repository) BookmarkDelete

func (r *Repository) BookmarkDelete(userUUID, uid string) error

func (*Repository) BookmarkGetAll

func (r *Repository) BookmarkGetAll(userUUID string) ([]bookmark.Bookmark, error)

func (*Repository) BookmarkGetAllPrivate

func (r *Repository) BookmarkGetAllPrivate(userUUID string) ([]bookmark.Bookmark, error)

func (*Repository) BookmarkGetAllPublic

func (r *Repository) BookmarkGetAllPublic(userUUID string) ([]bookmark.Bookmark, error)

func (*Repository) BookmarkGetByTag

func (r *Repository) BookmarkGetByTag(userUUID string, tag string) ([]bookmark.Bookmark, error)

func (*Repository) BookmarkGetByUID

func (r *Repository) BookmarkGetByUID(userUUID, uid string) (bookmark.Bookmark, error)

func (*Repository) BookmarkGetByURL

func (r *Repository) BookmarkGetByURL(userUUID, u string) (bookmark.Bookmark, error)

func (*Repository) BookmarkGetCount

func (r *Repository) BookmarkGetCount(userUUID string, visibility querying.Visibility) (uint, error)

func (*Repository) BookmarkGetN

func (r *Repository) BookmarkGetN(userUUID string, visibility querying.Visibility, n uint, offset uint) ([]bookmark.Bookmark, error)

func (*Repository) BookmarkGetPublicByUID

func (r *Repository) BookmarkGetPublicByUID(userUUID, uid string) (bookmark.Bookmark, error)

func (*Repository) BookmarkIsURLRegistered

func (r *Repository) BookmarkIsURLRegistered(userUUID, url string) (bool, error)

func (*Repository) BookmarkIsURLRegisteredToAnotherUID

func (r *Repository) BookmarkIsURLRegisteredToAnotherUID(userUUID, url, uid string) (bool, error)

func (*Repository) BookmarkSearchCount

func (r *Repository) BookmarkSearchCount(userUUID string, visibility querying.Visibility, searchTerms string) (uint, error)

func (*Repository) BookmarkSearchN

func (r *Repository) BookmarkSearchN(userUUID string, visibility querying.Visibility, searchTerms string, n uint, offset uint) ([]bookmark.Bookmark, error)

func (*Repository) BookmarkTagUpdateMany

func (r *Repository) BookmarkTagUpdateMany(bookmarks []bookmark.Bookmark) (int64, error)

func (*Repository) BookmarkUpdate

func (r *Repository) BookmarkUpdate(b bookmark.Bookmark) error

func (*Repository) BookmarkUpsertMany

func (r *Repository) BookmarkUpsertMany(bookmarks []bookmark.Bookmark) (int64, error)

func (*Repository) OwnerGetByUUID

func (r *Repository) OwnerGetByUUID(userUUID string) (querying.Owner, error)

func (*Repository) SessionAdd

func (r *Repository) SessionAdd(sess session.Session) error

func (*Repository) SessionGetByRememberTokenHash

func (r *Repository) SessionGetByRememberTokenHash(hash string) (session.Session, error)

func (*Repository) TagFilterCount

func (r *Repository) TagFilterCount(userUUID string, visibility querying.Visibility, filterTerm string) (uint, error)

func (*Repository) TagFilterN

func (r *Repository) TagFilterN(userUUID string, visibility querying.Visibility, filterTerm string, n uint, offset uint) ([]querying.Tag, error)

func (*Repository) TagGetAll

func (r *Repository) TagGetAll(userUUID string, visibility querying.Visibility) ([]querying.Tag, error)

func (*Repository) TagGetCount

func (r *Repository) TagGetCount(userUUID string, visibility querying.Visibility) (uint, error)

func (*Repository) TagGetN

func (r *Repository) TagGetN(userUUID string, visibility querying.Visibility, n uint, offset uint) ([]querying.Tag, error)

func (*Repository) UserAdd

func (r *Repository) UserAdd(u user.User) error

func (*Repository) UserDeleteByUUID

func (r *Repository) UserDeleteByUUID(userUUID string) error

func (*Repository) UserGetAll

func (r *Repository) UserGetAll() ([]user.User, error)

func (*Repository) UserGetByEmail

func (r *Repository) UserGetByEmail(email string) (user.User, error)

func (*Repository) UserGetByNickName

func (r *Repository) UserGetByNickName(nick string) (user.User, error)

func (*Repository) UserGetByUUID

func (r *Repository) UserGetByUUID(userUUID string) (user.User, error)

func (*Repository) UserIsEmailRegistered

func (r *Repository) UserIsEmailRegistered(email string) (bool, error)

func (*Repository) UserIsNickNameRegistered

func (r *Repository) UserIsNickNameRegistered(nick string) (bool, error)

func (*Repository) UserUpdate

func (r *Repository) UserUpdate(u user.User) error

func (*Repository) UserUpdateInfo

func (r *Repository) UserUpdateInfo(info user.InfoUpdate) error

func (*Repository) UserUpdatePasswordHash

func (r *Repository) UserUpdatePasswordHash(passwordHash user.PasswordHashUpdate) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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