Documentation ¶
Index ¶
- func CreatePostgresConnection(config PostgresConfig) *pgx.ConnPool
- type Interface
- type PostgresConfig
- type Storage
- func (storage *Storage) AddStream(streamInterface entity.StreamInterface) (createdStream entity.StreamInterface, err error)
- func (storage *Storage) AddTopic(topic entity.TopicInterface) (result entity.TopicInterface, err error)
- func (storage *Storage) AddTweetStreams(tweetStreams entity.TweetStreamsInterface) (id int64, err error)
- func (storage *Storage) DeleteStream(streamID int64) (err error)
- func (storage *Storage) DeleteTopic(topicID int64) (err error)
- func (storage *Storage) GetActiveStreams() (streams []entity.StreamInterface, err error)
- func (storage *Storage) GetTopic(topicID int64) (topic entity.TopicInterface, err error)
- func (storage *Storage) GetTopicStreams(topicID int64) (streams []entity.StreamInterface, err error)
- func (storage *Storage) GetTopicTweets(topicID int64) (tweets []entity.TweetInterface, err error)
- func (storage *Storage) GetUserTopics(userId int64) (result []entity.TopicInterface, err error)
- func (storage *Storage) Login(email string, password string) (id *int64, err error)
- func (storage *Storage) SignUp(email string, password string) (id *int64, err error)
- func (storage *Storage) UpdateStream(streamInterface entity.StreamInterface) (updatedStream entity.StreamInterface, err error)
- func (storage *Storage) UpdateTopic(topic entity.TopicInterface) (result entity.TopicInterface, err error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreatePostgresConnection ¶
func CreatePostgresConnection(config PostgresConfig) *pgx.ConnPool
CreatePostgresConnection creates postgres connections pool
Types ¶
type Interface ¶
type Interface interface { AddTopic(TopicInterface) (result TopicInterface, err error) UpdateTopic(TopicInterface) (result TopicInterface, err error) GetUserTopics(userID int64) (result []TopicInterface, err error) GetTopic(topicID int64) (topic TopicInterface, err error) GetTopicStreams(topicID int64) (streams []StreamInterface, err error) GetTopicTweets(topicID int64) (tweets []TweetInterface, err error) GetActiveStreams() (streams []StreamInterface, err error) DeleteTopic(streamID int64) error AddTweetStreams(tweetStreams TweetStreamsInterface) (id int64, err error) SignUp(email string, password string) (id *int64, err error) Login(email string, password string) (id *int64, err error) AddStream(streamInterface StreamInterface) (result StreamInterface, err error) UpdateStream(streamInterface StreamInterface) (result StreamInterface, err error) DeleteStream(streamID int64) error }
Interface must be implemented by DBMS based storage.
func NewStorage ¶
NewStorage creates new Storage instance
type PostgresConfig ¶
type PostgresConfig struct {
DSN string
}
PostgresConfig contains options for the Postgres connections pool
type Storage ¶
type Storage struct {
// contains filtered or unexported fields
}
Storage provides ability to store and to retrieve twits and other entities
func (*Storage) AddStream ¶
func (storage *Storage) AddStream(streamInterface entity.StreamInterface) (createdStream entity.StreamInterface, err error)
func (*Storage) AddTopic ¶
func (storage *Storage) AddTopic(topic entity.TopicInterface) (result entity.TopicInterface, err error)
AddTopic inserts topic into database
func (*Storage) AddTweetStreams ¶
func (storage *Storage) AddTweetStreams(tweetStreams entity.TweetStreamsInterface) (id int64, err error)
func (*Storage) DeleteStream ¶
func (*Storage) DeleteTopic ¶
func (*Storage) GetActiveStreams ¶
func (storage *Storage) GetActiveStreams() (streams []entity.StreamInterface, err error)
GetStreams returns all existing streams
func (*Storage) GetTopic ¶
func (storage *Storage) GetTopic(topicID int64) (topic entity.TopicInterface, err error)
func (*Storage) GetTopicStreams ¶
func (storage *Storage) GetTopicStreams(topicID int64) (streams []entity.StreamInterface, err error)
GetStreams returns all existing streams
func (*Storage) GetTopicTweets ¶
func (storage *Storage) GetTopicTweets(topicID int64) (tweets []entity.TweetInterface, err error)
func (*Storage) GetUserTopics ¶
func (storage *Storage) GetUserTopics(userId int64) (result []entity.TopicInterface, err error)
func (*Storage) UpdateStream ¶
func (storage *Storage) UpdateStream(streamInterface entity.StreamInterface) (updatedStream entity.StreamInterface, err error)
UpdateStream just update stream
func (*Storage) UpdateTopic ¶
func (storage *Storage) UpdateTopic(topic entity.TopicInterface) (result entity.TopicInterface, err error)
AddTopic inserts topic into database
Click to show internal directories.
Click to hide internal directories.