postgres

package
v0.0.0-...-4a5e4cf Latest Latest
Warning

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

Go to latest
Published: Mar 19, 2024 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Storage

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

func New

func New(dsn string) (*Storage, error)

func (*Storage) DeletePostByID

func (s *Storage) DeletePostByID(ctx context.Context, postID int64) error

func (*Storage) DeletePostTagsForPostID

func (s *Storage) DeletePostTagsForPostID(ctx context.Context, postID int64) error

func (*Storage) InsertPost

func (s *Storage) InsertPost(ctx context.Context, title string, slug string, markdown []byte, html []byte, featured bool, isPage bool, published bool, metaDescription string, image string, createdAt time.Time, createdBy int64) (int64, error)

func (*Storage) InsertPostTag

func (s *Storage) InsertPostTag(ctx context.Context, postID int64, tagID int64) error

func (*Storage) InsertRoleUser

func (s *Storage) InsertRoleUser(ctx context.Context, roleID int64, userID int64) error

func (*Storage) InsertTag

func (s *Storage) InsertTag(ctx context.Context, name string, slug string, createdAt time.Time, createdBy int64) (int64, error)

func (*Storage) InsertUser

func (s *Storage) InsertUser(ctx context.Context, name string, slug string, password string, email string, image string, cover string, createdAt time.Time, createdBy int64) (int64, error)

func (*Storage) RetrieveActiveTheme

func (s *Storage) RetrieveActiveTheme(ctx context.Context) (string, error)

func (*Storage) RetrieveBlog

func (s *Storage) RetrieveBlog(ctx context.Context) (*structure.Blog, error)

func (*Storage) RetrieveHashedPasswordForUser

func (s *Storage) RetrieveHashedPasswordForUser(ctx context.Context, name string) ([]byte, error)

func (*Storage) RetrieveNumberOfPosts

func (s *Storage) RetrieveNumberOfPosts(ctx context.Context) (int64, error)

func (*Storage) RetrieveNumberOfPostsByTag

func (s *Storage) RetrieveNumberOfPostsByTag(ctx context.Context, tagID int64) (int64, error)

func (*Storage) RetrieveNumberOfPostsByUser

func (s *Storage) RetrieveNumberOfPostsByUser(ctx context.Context, userID int64) (int64, error)

func (*Storage) RetrievePostByID

func (s *Storage) RetrievePostByID(ctx context.Context, postID int64) (*structure.Post, error)

func (*Storage) RetrievePostBySlug

func (s *Storage) RetrievePostBySlug(ctx context.Context, slug string) (*structure.Post, error)

func (*Storage) RetrievePostsByTag

func (s *Storage) RetrievePostsByTag(ctx context.Context, tagID int64, limit int64, offset int64) ([]structure.Post, error)

func (*Storage) RetrievePostsByUser

func (s *Storage) RetrievePostsByUser(ctx context.Context, userID int64, limit int64, offset int64) ([]structure.Post, error)

func (*Storage) RetrievePostsForApi

func (s *Storage) RetrievePostsForApi(ctx context.Context, limit int64, offset int64) ([]structure.Post, error)

func (*Storage) RetrievePostsForIndex

func (s *Storage) RetrievePostsForIndex(ctx context.Context, limit int64, offset int64) ([]structure.Post, error)

func (*Storage) RetrieveTag

func (s *Storage) RetrieveTag(ctx context.Context, tagID int64) (*structure.Tag, error)

func (*Storage) RetrieveTagBySlug

func (s *Storage) RetrieveTagBySlug(ctx context.Context, slug string) (*structure.Tag, error)

func (*Storage) RetrieveTagIDBySlug

func (s *Storage) RetrieveTagIDBySlug(ctx context.Context, slug string) (int64, error)

func (*Storage) RetrieveTags

func (s *Storage) RetrieveTags(ctx context.Context, postID int64) ([]structure.Tag, error)

func (*Storage) RetrieveUser

func (s *Storage) RetrieveUser(ctx context.Context, userID int64) (*structure.User, error)

func (*Storage) RetrieveUserByName

func (s *Storage) RetrieveUserByName(ctx context.Context, name string) (*structure.User, error)

RetrieveUserByName Retrieve user by name

func (*Storage) RetrieveUserBySlug

func (s *Storage) RetrieveUserBySlug(ctx context.Context, slug string) (*structure.User, error)

func (*Storage) RetrieveUsersCount

func (s *Storage) RetrieveUsersCount(ctx context.Context) int

func (*Storage) Tx

func (s *Storage) Tx(ctx context.Context, fn func(ctx context.Context, tx pgx.Tx, s *Storage) error) error

func (*Storage) UpdateActiveTheme

func (s *Storage) UpdateActiveTheme(ctx context.Context, activeTheme string, updatedAt time.Time, updatedBy int64) error

func (*Storage) UpdateLastLogin

func (s *Storage) UpdateLastLogin(ctx context.Context, logInDate time.Time, userID int64) error

func (*Storage) UpdatePost

func (s *Storage) UpdatePost(ctx context.Context, postID int64, title string, slug string, markdown []byte, html []byte, featured bool, isPage bool, published bool, metaDescription string, image string, updatedAt time.Time, updatedBy int64) error

func (*Storage) UpdateSettings

func (s *Storage) UpdateSettings(
	ctx context.Context,
	title string,
	description string,
	logo string,
	cover string,
	postsPerPage int64,
	activeTheme string,
	navigation string,
	updatedAt time.Time,
	updatedBy int64,
) error

func (*Storage) UpdateUser

func (s *Storage) UpdateUser(ctx context.Context, userID int64, name string, slug string, email string, image string, cover string, bio string, website string, location string, updatedAt time.Time, updatedBy int64) error

func (*Storage) UpdateUserPassword

func (s *Storage) UpdateUserPassword(ctx context.Context, userID int64, password string, updatedAt time.Time, updatedBy int64) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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