sql

package
v0.0.0-...-dc8ef24 Latest Latest
Warning

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

Go to latest
Published: Jul 7, 2021 License: AGPL-3.0 Imports: 7 Imported by: 0

Documentation

Overview

Package repo provides routines to operate on Syndications SQL repo using models defined in the models package to map data in said repo.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AutoMigrateTables

func AutoMigrateTables(db *gorm.DB)

Types

type Categories

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

func NewCategories

func NewCategories(db *gorm.DB) Categories

func (Categories) AddFeed

func (c Categories) AddFeed(userID, feedID, ctgID string) error

AddFeed associates a feed to a category with ctgID

func (Categories) CategoryWithID

func (c Categories) CategoryWithID(userID, id string) (ctg models.Category, found bool)

CategoryWithID returns a category with ID owned by user

func (Categories) CategoryWithName

func (c Categories) CategoryWithName(userID, name string) (ctg models.Category, found bool)

CategoryWithName returns a Category that has a matching name and belongs to the given user

func (Categories) Create

func (c Categories) Create(userID string, ctg *models.Category)

Create a new Category owned by user

func (Categories) Delete

func (c Categories) Delete(userID, id string) error

Delete a category with id owned by user

func (Categories) Feeds

func (c Categories) Feeds(userID string, page models.Page) (feeds []models.Feed, next string)

Feeds returns all Feeds in category with ctgID owned by user

func (Categories) List

func (c Categories) List(userID string, page models.Page) (categories []models.Category, next string)

List all Categories owned by user

func (Categories) Mark

func (c Categories) Mark(userID, ctgID string, marker models.Marker) error

Mark applies marker to a category with id and owned by user

func (Categories) Stats

func (c Categories) Stats(userID, ctgID string) (models.Stats, error)

Stats returns all Stats for a Category with the given id and that is owned by user

func (Categories) Uncategorized

func (c Categories) Uncategorized(userID string, page models.Page) (feeds []models.Feed, next string)

Uncategorized returns all Feeds that belong to a category with categoryID

func (Categories) Update

func (c Categories) Update(userID string, ctg *models.Category) error

Update a category owned by user

type Entries

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

func NewEntries

func NewEntries(db *gorm.DB) Entries

func (Entries) Create

func (e Entries) Create(userID string, entry *models.Entry)

Create a new Entry owned by user

func (Entries) DeleteOldEntries

func (e Entries) DeleteOldEntries(userID string, timestamp time.Time)

DeleteOldEntries deletes entries older than a timestamp

func (Entries) EntryWithGUID

func (e Entries) EntryWithGUID(userID, guid string) (entry models.Entry, found bool)

EntryWithGUID returns an Entry with GUID and owned by user

func (Entries) EntryWithID

func (e Entries) EntryWithID(userID, id string) (entry models.Entry, found bool)

EntryWithID returns an Entry with id owned by user

func (Entries) List

func (e Entries) List(userID string, page models.Page) (entries []models.Entry, next string)

List all entries owned by user

func (Entries) ListFromCategory

func (e Entries) ListFromCategory(userID string, page models.Page) (entries []models.Entry, next string)

ListFromCategory all Entries that are associated to a Category

func (Entries) ListFromFeed

func (e Entries) ListFromFeed(userID string, page models.Page) (entries []models.Entry, next string)

ListFromFeed returns all Entries associated to a feed

func (Entries) ListFromTags

func (e Entries) ListFromTags(userID string, tagIDs []string, page models.Page) (entries []models.Entry, next string)

ListFromTags returns all Entries that are related to a list of tags

func (Entries) Mark

func (e Entries) Mark(userID, id string, marker models.Marker) error

Mark applies marker to an entry with id and owned by user

func (Entries) MarkAll

func (e Entries) MarkAll(userID string, marker models.Marker)

MarkAll entries

func (Entries) Stats

func (e Entries) Stats(userID string) models.Stats

Stats returns all Stats for feeds owned by user

func (Entries) TagEntries

func (e Entries) TagEntries(userID, tagID string, entryIDs []string) error

TagEntries with the given tag for user

type Feeds

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

func NewFeeds

func NewFeeds(db *gorm.DB) Feeds

func (Feeds) Create

func (f Feeds) Create(userID string, feed *models.Feed)

Create a new feed owned by user

func (Feeds) Delete

func (f Feeds) Delete(userID, id string) error

Delete a feed owned by user

func (Feeds) FeedWithID

func (f Feeds) FeedWithID(userID, id string) (feed models.Feed, found bool)

FeedWithID returns a Feed with id and owned by user

func (Feeds) List

func (f Feeds) List(userID string, page models.Page) (feeds []models.Feed, next string)

List all Feeds owned by user

func (Feeds) Mark

func (f Feeds) Mark(userID, id string, marker models.Marker) error

Mark applies marker to a Feed with id and owned by user

func (Feeds) Stats

func (f Feeds) Stats(userID, id string) (models.Stats, error)

Stats returns all Stats for a Feed with the given id and that is owned by user

func (Feeds) Update

func (f Feeds) Update(userID string, feed *models.Feed) error

Update a feed owned by user

type Tags

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

func NewTags

func NewTags(db *gorm.DB) Tags

func (Tags) Create

func (t Tags) Create(userID string, tag *models.Tag)

Create a new Tag for user

func (Tags) Delete

func (t Tags) Delete(userID, id string) error

Delete a tag owned by user

func (Tags) List

func (t Tags) List(userID string, page models.Page) (tags []models.Tag, next string)

List all Tags owned by user

func (Tags) TagWithID

func (t Tags) TagWithID(userID, id string) (tag models.Tag, found bool)

TagWithID returns a Tag with id that belongs to user

func (Tags) TagWithName

func (t Tags) TagWithName(userID, name string) (tag models.Tag, found bool)

TagWithName returns a Tag that has a matching name and belongs to the given user

func (Tags) Update

func (t Tags) Update(userID string, tag *models.Tag) error

Update a tag owned by user

type Users

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

func NewUsers

func NewUsers(db *gorm.DB) Users

func (Users) Create

func (u Users) Create(user *models.User)

Create a new user

func (Users) Delete

func (u Users) Delete(id string) error

Delete a user

func (Users) List

func (u Users) List(page models.Page) (users []models.User, next string)

List all users

func (Users) Update

func (u Users) Update(user *models.User) error

Update a user

func (Users) UserWithID

func (u Users) UserWithID(id string) (user models.User, found bool)

UserWithID returns a User with id

func (Users) UserWithName

func (u Users) UserWithName(name string) (user models.User, found bool)

UserWithName returns a User with username

Jump to

Keyboard shortcuts

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