postgres

package
v0.0.0-...-2384305 Latest Latest
Warning

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

Go to latest
Published: Dec 12, 2023 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CommentStore

type CommentStore struct {
	DB *sqlx.DB
}

func (*CommentStore) Comment

func (c *CommentStore) Comment(id uuid.UUID) (goreddit.Comment, error)

func (*CommentStore) CommentsByPost

func (c *CommentStore) CommentsByPost(postID uuid.UUID) ([]goreddit.Comment, error)

func (*CommentStore) CreateComment

func (c *CommentStore) CreateComment(cmt *goreddit.Comment) error

func (*CommentStore) DeleteComment

func (c *CommentStore) DeleteComment(id uuid.UUID) error

func (*CommentStore) UpdateComment

func (c *CommentStore) UpdateComment(t *goreddit.Comment) error

type PostStore

type PostStore struct {
	DB *sqlx.DB
}

func (*PostStore) CreatePost

func (s *PostStore) CreatePost(p *goreddit.Post) error

func (*PostStore) DeletePost

func (s *PostStore) DeletePost(id uuid.UUID) error

func (*PostStore) Post

func (s *PostStore) Post(id uuid.UUID) (goreddit.Post, error)

func (*PostStore) Posts

func (s *PostStore) Posts() ([]goreddit.Post, error)

func (*PostStore) PostsByThread

func (s *PostStore) PostsByThread(threadID uuid.UUID) ([]goreddit.Post, error)

PostsByThread retrieves the posts per thread

func (*PostStore) UpdatePost

func (s *PostStore) UpdatePost(p *goreddit.Post) error

type Store

type Store struct {
	*ThreadStore
	*PostStore
	*CommentStore
	*UserStore
}

Store struct that contains the PostgreSQL stores

func NewStore

func NewStore(dataSourceName string) (*Store, error)

NewStore creates a concrete implementation of the Store struct with the dataSourceName

type ThreadStore

type ThreadStore struct {
	DB *sqlx.DB
}

ThreadStore is a struct with a reference to sqlx.DB

func (*ThreadStore) CreateThread

func (s *ThreadStore) CreateThread(t *goreddit.Thread) error

func (*ThreadStore) DeleteThread

func (s *ThreadStore) DeleteThread(id uuid.UUID) error

func (*ThreadStore) Thread

func (s *ThreadStore) Thread(id uuid.UUID) (goreddit.Thread, error)

func (*ThreadStore) Threads

func (s *ThreadStore) Threads() ([]goreddit.Thread, error)

func (*ThreadStore) UpdateThread

func (s *ThreadStore) UpdateThread(t *goreddit.Thread) error

type UserStore

type UserStore struct {
	DB *sqlx.DB
}

UserStore is a struct with a reference to sqlx.DB

func (*UserStore) CreateUser

func (s *UserStore) CreateUser(t *goreddit.User) error

func (*UserStore) DeleteUser

func (s *UserStore) DeleteUser(id uuid.UUID) error

func (*UserStore) UpdateUser

func (s *UserStore) UpdateUser(t *goreddit.User) error

func (*UserStore) User

func (s *UserStore) User(id uuid.UUID) (goreddit.User, error)

func (*UserStore) UserByUsername

func (s *UserStore) UserByUsername(username string) (goreddit.User, error)

func (*UserStore) Users

func (s *UserStore) Users() ([]goreddit.User, error)

Jump to

Keyboard shortcuts

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