postgresql

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Dec 7, 2024 License: MIT Imports: 20 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 DBCategory added in v0.2.0

type DBCategory struct {
	UUID     string `db:"uuid"`
	UserUUID string `db:"user_uuid"`

	Name string `db:"name"`
	Slug string `db:"slug"`

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

type DBEntry added in v0.2.0

type DBEntry struct {
	UID      string `db:"uid"`
	FeedUUID string `db:"feed_uuid"`

	URL           string   `db:"url"`
	Title         string   `db:"title"`
	Summary       string   `db:"summary"`
	TextRankTerms []string `db:"textrank_terms"`

	PublishedAt time.Time `db:"published_at"`
	UpdatedAt   time.Time `db:"updated_at"`
}

type DBEntryMetadata added in v0.2.0

type DBEntryMetadata struct {
	UserUUID string `db:"user_uuid"`
	EntryUID string `db:"entry_uid"`
	Read     bool   `db:"read"`
}

type DBFeed added in v0.2.0

type DBFeed struct {
	UUID string `db:"uuid"`

	FeedURL     string `db:"feed_url"`
	Title       string `db:"title"`
	Description string `db:"description"`
	Slug        string `db:"slug"`

	ETag         string    `db:"etag"`
	LastModified time.Time `db:"last_modified"`

	// xxHash64 returns a 64-bit unsigned integer hash value,
	// whereas it is stored as a 64-bit signed integer in the database (BIGINT).
	Hash int64 `db:"hash_xxhash64"`

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

type DBQueryingSubscribedFeedEntry added in v0.3.0

type DBQueryingSubscribedFeedEntry struct {
	DBEntry

	FeedTitle string `db:"feed_title"`
	Read      bool   `db:"read"`
}

type DBQueryingSubscription added in v0.3.0

type DBQueryingSubscription struct {
	SubscriptionUUID  string `db:"uuid"`
	SubscriptionAlias string `db:"alias"`
	CategoryUUID      string `db:"category_uuid"`

	FeedTitle       string `db:"title"`
	FeedDescription string `db:"description"`
}

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 DBSubscribedFeed added in v0.2.0

type DBSubscribedFeed struct {
	UUID    string `db:"uuid"`
	FeedURL string `db:"feed_url"`
	Title   string `db:"title"`
	Slug    string `db:"slug"`

	Alias  string `db:"alias"`
	Unread uint   `db:"unread"`

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

type DBSubscription added in v0.2.0

type DBSubscription struct {
	UUID         string `db:"uuid"`
	CategoryUUID string `db:"category_uuid"`
	FeedUUID     string `db:"feed_uuid"`
	UserUUID     string `db:"user_uuid"`

	Alias string `db:"alias"`

	CreatedAt time.Time `db:"created_at"`
	UpdatedAt time.Time `db:"updated_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 bookmarkquerying.Visibility) (uint, error)

func (*Repository) BookmarkGetN

func (r *Repository) BookmarkGetN(userUUID string, visibility bookmarkquerying.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 bookmarkquerying.Visibility, searchTerms string) (uint, error)

func (*Repository) BookmarkSearchN

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

func (*Repository) BookmarkTagFilterCount added in v0.2.0

func (r *Repository) BookmarkTagFilterCount(userUUID string, visibility bookmarkquerying.Visibility, filterTerm string) (uint, error)

func (*Repository) BookmarkTagFilterN added in v0.2.0

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

func (*Repository) BookmarkTagGetAll added in v0.2.0

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

func (*Repository) BookmarkTagGetCount added in v0.2.0

func (r *Repository) BookmarkTagGetCount(userUUID string, visibility bookmarkquerying.Visibility) (uint, error)

func (*Repository) BookmarkTagGetN added in v0.2.0

func (r *Repository) BookmarkTagGetN(userUUID string, visibility bookmarkquerying.Visibility, n uint, offset uint) ([]bookmarkquerying.Tag, 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) FeedCategoryCreate added in v0.2.0

func (r *Repository) FeedCategoryCreate(c feed.Category) error

func (*Repository) FeedCategoryDelete added in v0.2.0

func (r *Repository) FeedCategoryDelete(userUUID string, categoryUUID string) error

func (*Repository) FeedCategoryGetByName added in v0.2.0

func (r *Repository) FeedCategoryGetByName(userUUID string, name string) (feed.Category, error)

func (*Repository) FeedCategoryGetBySlug added in v0.2.0

func (r *Repository) FeedCategoryGetBySlug(userUUID string, slug string) (feed.Category, error)

func (*Repository) FeedCategoryGetByUUID added in v0.2.0

func (r *Repository) FeedCategoryGetByUUID(userUUID string, categoryUUID string) (feed.Category, error)

func (*Repository) FeedCategoryGetMany added in v0.2.0

func (r *Repository) FeedCategoryGetMany(userUUID string) ([]feed.Category, error)

func (*Repository) FeedCategoryNameAndSlugAreRegistered added in v0.2.0

func (r *Repository) FeedCategoryNameAndSlugAreRegistered(userUUID string, name string, slug string) (bool, error)

func (*Repository) FeedCategoryNameAndSlugAreRegisteredToAnotherCategory added in v0.2.0

func (r *Repository) FeedCategoryNameAndSlugAreRegisteredToAnotherCategory(userUUID string, categoryUUID string, name string, slug string) (bool, error)

func (*Repository) FeedCategorySubscriptionsGetAll added in v0.2.0

func (r *Repository) FeedCategorySubscriptionsGetAll(userUUID string) ([]feedexporting.CategorySubscriptions, error)

func (*Repository) FeedCategoryUpdate added in v0.2.0

func (r *Repository) FeedCategoryUpdate(c feed.Category) error

func (*Repository) FeedCreate added in v0.2.0

func (r *Repository) FeedCreate(f feed.Feed) error

func (*Repository) FeedEntryCreateMany added in v0.2.0

func (r *Repository) FeedEntryCreateMany(entries []feed.Entry) (int64, error)

func (*Repository) FeedEntryGetCount added in v0.2.0

func (r *Repository) FeedEntryGetCount(userUUID string) (uint, error)

func (*Repository) FeedEntryGetCountByCategory added in v0.2.0

func (r *Repository) FeedEntryGetCountByCategory(userUUID string, categoryUUID string) (uint, error)

func (*Repository) FeedEntryGetCountByCategoryAndQuery added in v0.3.0

func (r *Repository) FeedEntryGetCountByCategoryAndQuery(userUUID string, categoryUUID string, searchTerms string) (uint, error)

func (*Repository) FeedEntryGetCountByQuery added in v0.3.0

func (r *Repository) FeedEntryGetCountByQuery(userUUID string, searchTerms string) (uint, error)

func (*Repository) FeedEntryGetCountBySubscription added in v0.2.0

func (r *Repository) FeedEntryGetCountBySubscription(userUUID string, subscriptionUUID string) (uint, error)

func (*Repository) FeedEntryGetCountBySubscriptionAndQuery added in v0.3.0

func (r *Repository) FeedEntryGetCountBySubscriptionAndQuery(userUUID string, subscriptionUUID string, searchTerms string) (uint, error)

func (*Repository) FeedEntryGetN added in v0.2.0

func (r *Repository) FeedEntryGetN(feedUUID string, n uint) ([]feed.Entry, error)

func (*Repository) FeedEntryMarkAllAsRead added in v0.2.0

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

func (*Repository) FeedEntryMarkAllAsReadByCategory added in v0.2.0

func (r *Repository) FeedEntryMarkAllAsReadByCategory(userUUID string, categoryUUID string) error

func (*Repository) FeedEntryMarkAllAsReadBySubscription added in v0.2.0

func (r *Repository) FeedEntryMarkAllAsReadBySubscription(userUUID string, subscriptionUUID string) error

func (*Repository) FeedEntryMetadataCreate added in v0.2.0

func (r *Repository) FeedEntryMetadataCreate(entryMetadata feed.EntryMetadata) error

func (*Repository) FeedEntryMetadataGetByUID added in v0.2.0

func (r *Repository) FeedEntryMetadataGetByUID(userUUID string, entryUID string) (feed.EntryMetadata, error)

func (*Repository) FeedEntryMetadataUpdate added in v0.2.0

func (r *Repository) FeedEntryMetadataUpdate(entryMetadata feed.EntryMetadata) error

func (*Repository) FeedEntryUpsertMany added in v0.2.0

func (r *Repository) FeedEntryUpsertMany(entries []feed.Entry) (int64, error)

func (*Repository) FeedGetBySlug added in v0.2.0

func (r *Repository) FeedGetBySlug(feedSlug string) (feed.Feed, error)

func (*Repository) FeedGetByURL added in v0.2.0

func (r *Repository) FeedGetByURL(feedURL string) (feed.Feed, error)

func (*Repository) FeedGetByUUID added in v0.2.0

func (r *Repository) FeedGetByUUID(feedUUID string) (feed.Feed, error)

func (*Repository) FeedGetNByLastSynchronizationTime added in v0.2.0

func (r *Repository) FeedGetNByLastSynchronizationTime(n uint, before time.Time) ([]feed.Feed, error)

func (*Repository) FeedQueryingSubscriptionByUUID added in v0.3.0

func (r *Repository) FeedQueryingSubscriptionByUUID(userUUID string, subscriptionUUID string) (feedquerying.Subscription, error)

func (*Repository) FeedQueryingSubscriptionsByCategory added in v0.3.0

func (r *Repository) FeedQueryingSubscriptionsByCategory(userUUID string) ([]feedquerying.SubscriptionsByCategory, error)

func (*Repository) FeedSubscriptionCategoryGetAll added in v0.2.0

func (r *Repository) FeedSubscriptionCategoryGetAll(userUUID string) ([]feedquerying.SubscribedFeedsByCategory, error)

func (*Repository) FeedSubscriptionCreate added in v0.2.0

func (r *Repository) FeedSubscriptionCreate(s feed.Subscription) (feed.Subscription, error)

func (*Repository) FeedSubscriptionDelete added in v0.2.0

func (r *Repository) FeedSubscriptionDelete(userUUID string, subscriptionUUID string) error

func (*Repository) FeedSubscriptionEntryGetN added in v0.2.0

func (r *Repository) FeedSubscriptionEntryGetN(userUUID string, n uint, offset uint) ([]feedquerying.SubscribedFeedEntry, error)

func (*Repository) FeedSubscriptionEntryGetNByCategory added in v0.2.0

func (r *Repository) FeedSubscriptionEntryGetNByCategory(userUUID string, categoryUUID string, n uint, offset uint) ([]feedquerying.SubscribedFeedEntry, error)

func (*Repository) FeedSubscriptionEntryGetNByCategoryAndQuery added in v0.3.0

func (r *Repository) FeedSubscriptionEntryGetNByCategoryAndQuery(userUUID string, categoryUUID string, searchTerms string, n uint, offset uint) ([]feedquerying.SubscribedFeedEntry, error)

func (*Repository) FeedSubscriptionEntryGetNByQuery added in v0.3.0

func (r *Repository) FeedSubscriptionEntryGetNByQuery(userUUID string, searchTerms string, n uint, offset uint) ([]feedquerying.SubscribedFeedEntry, error)

func (*Repository) FeedSubscriptionEntryGetNBySubscription added in v0.2.0

func (r *Repository) FeedSubscriptionEntryGetNBySubscription(userUUID string, subscriptionUUID string, n uint, offset uint) ([]feedquerying.SubscribedFeedEntry, error)

func (*Repository) FeedSubscriptionEntryGetNBySubscriptionAndQuery added in v0.3.0

func (r *Repository) FeedSubscriptionEntryGetNBySubscriptionAndQuery(userUUID string, subscriptionUUID string, searchTerms string, n uint, offset uint) ([]feedquerying.SubscribedFeedEntry, error)

func (*Repository) FeedSubscriptionGetByFeed added in v0.2.0

func (r *Repository) FeedSubscriptionGetByFeed(userUUID string, feedUUID string) (feed.Subscription, error)

func (*Repository) FeedSubscriptionGetByUUID added in v0.2.0

func (r *Repository) FeedSubscriptionGetByUUID(userUUID string, subscriptionUUID string) (feed.Subscription, error)

func (*Repository) FeedSubscriptionIsRegistered added in v0.2.0

func (r *Repository) FeedSubscriptionIsRegistered(userUUID string, feedUUID string) (bool, error)

func (*Repository) FeedSubscriptionUpdate added in v0.2.0

func (r *Repository) FeedSubscriptionUpdate(s feed.Subscription) error

func (*Repository) FeedUpdateFetchMetadata added in v0.2.0

func (r *Repository) FeedUpdateFetchMetadata(feedFetchMetadata feedsynchronizing.FeedFetchMetadata) error

func (*Repository) FeedUpdateMetadata added in v0.3.0

func (r *Repository) FeedUpdateMetadata(feedMetadata feedsynchronizing.FeedMetadata) error

func (*Repository) OwnerGetByUUID

func (r *Repository) OwnerGetByUUID(userUUID string) (bookmarkquerying.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) 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