postgres

package
v1.3.1 Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2023 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var PAGER_SIZE = 15
View Source
var SelectPost = `` /* 189-byte string literal not displayed */

Functions

func CreatePostFromRow

func CreatePostFromRow(r RowScanner) (*db.Post, error)

func CreatePostWithTagsFromRow

func CreatePostWithTagsFromRow(r RowScanner) (*db.Post, error)

Types

type PsqlDB

type PsqlDB struct {
	Logger *zap.SugaredLogger
	Db     *sql.DB
}

func NewDB

func NewDB(databaseUrl string, logger *zap.SugaredLogger) *PsqlDB

func (*PsqlDB) AddUser

func (me *PsqlDB) AddUser() (string, error)

func (*PsqlDB) AddViewCount

func (me *PsqlDB) AddViewCount(postID string) (int, error)

func (*PsqlDB) Close

func (me *PsqlDB) Close() error

func (*PsqlDB) FindAllPosts

func (me *PsqlDB) FindAllPosts(page *db.Pager, space string) (*db.Paginate[*db.Post], error)

func (*PsqlDB) FindAllPostsForUser

func (me *PsqlDB) FindAllPostsForUser(userID string, space string) ([]*db.Post, error)

func (*PsqlDB) FindAllProjects added in v1.2.0

func (me *PsqlDB) FindAllProjects(page *db.Pager) (*db.Paginate[*db.Project], error)

func (*PsqlDB) FindAllUpdatedPosts

func (me *PsqlDB) FindAllUpdatedPosts(page *db.Pager, space string) (*db.Paginate[*db.Post], error)

func (*PsqlDB) FindExpiredPosts

func (me *PsqlDB) FindExpiredPosts(space string) ([]*db.Post, error)

func (*PsqlDB) FindFeedItemsByPostID added in v1.1.5

func (me *PsqlDB) FindFeedItemsByPostID(postID string) ([]*db.FeedItem, error)

func (*PsqlDB) FindKeysForUser

func (me *PsqlDB) FindKeysForUser(user *db.User) ([]*db.PublicKey, error)

func (*PsqlDB) FindPopularTags

func (me *PsqlDB) FindPopularTags(space string) ([]string, error)

func (*PsqlDB) FindPost

func (me *PsqlDB) FindPost(postID string) (*db.Post, error)

func (*PsqlDB) FindPostWithFilename

func (me *PsqlDB) FindPostWithFilename(filename string, persona_id string, space string) (*db.Post, error)

func (*PsqlDB) FindPostWithSlug

func (me *PsqlDB) FindPostWithSlug(slug string, user_id string, space string) (*db.Post, error)

func (*PsqlDB) FindPosts

func (me *PsqlDB) FindPosts() ([]*db.Post, error)

func (*PsqlDB) FindPostsBeforeDate

func (me *PsqlDB) FindPostsBeforeDate(date *time.Time, space string) ([]*db.Post, error)

func (*PsqlDB) FindPostsByTag

func (me *PsqlDB) FindPostsByTag(pager *db.Pager, tag, space string) (*db.Paginate[*db.Post], error)

func (*PsqlDB) FindPostsForUser

func (me *PsqlDB) FindPostsForUser(page *db.Pager, userID string, space string) (*db.Paginate[*db.Post], error)

func (*PsqlDB) FindProjectByName added in v1.2.0

func (me *PsqlDB) FindProjectByName(userID, name string) (*db.Project, error)
func (me *PsqlDB) FindProjectLinks(userID, name string) ([]*db.Project, error)

func (*PsqlDB) FindProjectsByPrefix added in v1.2.0

func (me *PsqlDB) FindProjectsByPrefix(userID, prefix string) ([]*db.Project, error)

func (*PsqlDB) FindProjectsByUser added in v1.2.0

func (me *PsqlDB) FindProjectsByUser(userID string) ([]*db.Project, error)

func (*PsqlDB) FindPublicKeyForKey

func (me *PsqlDB) FindPublicKeyForKey(key string) (*db.PublicKey, error)

func (*PsqlDB) FindSiteAnalytics

func (me *PsqlDB) FindSiteAnalytics(space string) (*db.Analytics, error)

func (*PsqlDB) FindTagsForPost

func (me *PsqlDB) FindTagsForPost(postID string) ([]string, error)

func (*PsqlDB) FindTokensForUser added in v1.2.0

func (me *PsqlDB) FindTokensForUser(userID string) ([]*db.Token, error)

func (*PsqlDB) FindTotalSizeForUser

func (me *PsqlDB) FindTotalSizeForUser(userID string) (int, error)

func (*PsqlDB) FindUpdatedPostsForUser

func (me *PsqlDB) FindUpdatedPostsForUser(userID string, space string) ([]*db.Post, error)

func (*PsqlDB) FindUser

func (me *PsqlDB) FindUser(userID string) (*db.User, error)

func (*PsqlDB) FindUserForKey

func (me *PsqlDB) FindUserForKey(username string, key string) (*db.User, error)

func (*PsqlDB) FindUserForName

func (me *PsqlDB) FindUserForName(name string) (*db.User, error)

func (*PsqlDB) FindUserForNameAndKey

func (me *PsqlDB) FindUserForNameAndKey(name string, key string) (*db.User, error)

func (*PsqlDB) FindUserForToken added in v1.2.0

func (me *PsqlDB) FindUserForToken(token string) (*db.User, error)

func (*PsqlDB) FindUserPostsByTag

func (me *PsqlDB) FindUserPostsByTag(page *db.Pager, tag, userID, space string) (*db.Paginate[*db.Post], error)

func (*PsqlDB) FindUsers

func (me *PsqlDB) FindUsers() ([]*db.User, error)

func (*PsqlDB) HasFeatureForUser

func (me *PsqlDB) HasFeatureForUser(userID string, feature string) bool

func (*PsqlDB) InsertFeedItems added in v1.1.5

func (me *PsqlDB) InsertFeedItems(postID string, items []*db.FeedItem) error

func (*PsqlDB) InsertPost

func (me *PsqlDB) InsertPost(post *db.Post) (*db.Post, error)

func (*PsqlDB) InsertProject added in v1.2.0

func (me *PsqlDB) InsertProject(userID, name, projectDir string) (string, error)

func (*PsqlDB) InsertToken added in v1.2.0

func (me *PsqlDB) InsertToken(userID, name string) (string, error)

func (*PsqlDB) LinkToProject added in v1.2.0

func (me *PsqlDB) LinkToProject(userID, projectID, projectDir string, commit bool) error

func (*PsqlDB) LinkUserKey

func (me *PsqlDB) LinkUserKey(userID string, key string) error

func (*PsqlDB) RemoveKeys

func (me *PsqlDB) RemoveKeys(keyIDs []string) error

func (*PsqlDB) RemovePosts

func (me *PsqlDB) RemovePosts(postIDs []string) error

func (*PsqlDB) RemoveProject added in v1.2.0

func (me *PsqlDB) RemoveProject(projectID string) error

func (*PsqlDB) RemoveToken added in v1.2.0

func (me *PsqlDB) RemoveToken(tokenID string) error

func (*PsqlDB) RemoveUsers

func (me *PsqlDB) RemoveUsers(userIDs []string) error

func (*PsqlDB) ReplaceAliasesForPost added in v1.1.5

func (me *PsqlDB) ReplaceAliasesForPost(aliases []string, postID string) error

func (*PsqlDB) ReplaceTagsForPost

func (me *PsqlDB) ReplaceTagsForPost(tags []string, postID string) error

func (*PsqlDB) SetUserName

func (me *PsqlDB) SetUserName(userID string, name string) error

func (*PsqlDB) UpdatePost

func (me *PsqlDB) UpdatePost(post *db.Post) (*db.Post, error)

func (*PsqlDB) UpdateProject added in v1.2.0

func (me *PsqlDB) UpdateProject(userID, name string) error

func (*PsqlDB) ValidateName

func (me *PsqlDB) ValidateName(name string) (bool, error)

type RowScanner

type RowScanner interface {
	Scan(dest ...any) error
}

Jump to

Keyboard shortcuts

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