store

package
v0.0.0-...-e7b3743 Latest Latest
Warning

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

Go to latest
Published: Feb 9, 2020 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNoRows = errors.New("No rows found")

ErrNoRows is returned if expected result is empty

Functions

This section is empty.

Types

type BookmarkReader

type BookmarkReader interface {
	SelectByUserID(DataHandler, *[]int, int) error
}

BookmarkReader handles all reads from bookmark data store

type BookmarkStore

type BookmarkStore interface {
	BookmarkReader
	BookmarkWriter
}

BookmarkStore handles manages interactions with bookmark data store

type BookmarkWriter

type BookmarkWriter interface {
	Create(DataHandler, int, int) error
	Delete(DataHandler, int, int) error
}

BookmarkWriter handles all writes to bookmark data store

type CategoryReader

type CategoryReader interface {
	SelectAll(DataHandler, *[]models.Category) error
	SelectByChannelID(DataHandler, *[]models.Category, int) error
}

CategoryReader handles reads from category data store

type CategoryStore

type CategoryStore interface {
	CategoryReader
}

CategoryStore manages interactions with category data store

type ChannelReader

type ChannelReader interface {
	SelectAll(DataHandler, *[]models.Channel) error
	SelectByCategoryID(DataHandler, *[]models.Channel, int) error
	SelectSubscribed(DataHandler, *[]models.Channel, int) error
	SelectRelated(DataHandler, *[]models.Channel, int) error
	SelectRecommended(DataHandler, *[]models.Channel) error
	SelectRecommendedByUserID(DataHandler, *[]models.Channel, int) error
	Search(DataHandler, *[]models.Channel, string) error
	GetByID(DataHandler, *models.Channel, int) error
	GetByURL(DataHandler, *models.Channel, string) error
}

ChannelReader handles reads from channel data store

type ChannelStore

type ChannelStore interface {
	ChannelReader
	ChannelWriter
}

ChannelStore handles interactions with channel data store

type ChannelWriter

type ChannelWriter interface {
	// CreateOrUpdate inserts/updates channel, and adds new categories/channels if needed
	CreateOrUpdate(DataHandler, *models.Channel) error
	AddCategories(DataHandler, *models.Channel) error
	AddPodcasts(DataHandler, *models.Channel) error
}

ChannelWriter handles writes to channel data store

type Connection

type Connection interface {
	DataHandler
	// contains filtered or unexported methods
}

Connection is a connection to the data store

type DBError

type DBError interface {
	error
	Query() string
}

DBError returns basic error plus original query

type DataHandler

type DataHandler interface {
	sqlx.Ext
	// contains filtered or unexported methods
}

DataHandler is a connection or transaction executing queries

type PlayReader

type PlayReader interface {
	SelectByUserID(DataHandler, *[]models.Play, int) error
}

PlayReader handles reads from play data store

type PlayStore

type PlayStore interface {
	PlayReader
	PlayWriter
}

PlayStore handles interactions with play data store

type PlayWriter

type PlayWriter interface {
	Create(DataHandler, int, int) error
	DeleteAll(DataHandler, int) error
}

PlayWriter handles writes to play data store

type PodcastReader

type PodcastReader interface {
	GetByID(DataHandler, *models.Podcast, int) error
	SelectAll(DataHandler, *models.PodcastList, int) error
	SelectSubscribed(DataHandler, *models.PodcastList, int, int) error
	SelectByChannel(DataHandler, *models.PodcastList, *models.Channel, int) error
	SelectBookmarked(DataHandler, *models.PodcastList, int, int) error
	SelectPlayed(DataHandler, *models.PodcastList, int, int) error
	Search(DataHandler, *models.PodcastList, string, int) error
	SearchBookmarked(DataHandler, *[]models.Podcast, string, int) error
	SearchByChannelID(DataHandler, *[]models.Podcast, string, int) error
}

PodcastReader handles reads from podcast data store

type PodcastStore

type PodcastStore interface {
	PodcastReader
}

PodcastStore handles interactions with podcast data store

type Store

type Store interface {
	Close() error
	Conn() Connection
	Users() UserStore
	Channels() ChannelStore
	Categories() CategoryStore
	Podcasts() PodcastStore
	Bookmarks() BookmarkStore
	Subscriptions() SubscriptionStore
	Plays() PlayStore
}

Store manages all data store interactions for the application

func New

func New(cfg *config.Config) (Store, error)

New returns a new Store instance

func NewMock

func NewMock() (Store, sqlmock.Sqlmock, error)

NewMock returns store instance and SqlMock handler for testing

type SubscriptionReader

type SubscriptionReader interface {
	SelectByUserID(DataHandler, *[]int, int) error
}

SubscriptionReader handles reads from subscription data store

type SubscriptionStore

type SubscriptionStore interface {
	SubscriptionReader
	SubscriptionWriter
}

SubscriptionStore manages interactions with subscription data store

type SubscriptionWriter

type SubscriptionWriter interface {
	Create(DataHandler, int, int) error
	Delete(DataHandler, int, int) error
}

SubscriptionWriter handles writes to subscription data store

type Transaction

type Transaction interface {
	DataHandler
	Rollback() error
	Commit() error
}

Transaction is a data store transaction

type UserReader

type UserReader interface {
	// GetbYID retrieves user by ID from the data store
	GetByID(DataHandler, *models.User, int) error
	// GetNameOrEmail retrieves user by name or email from the data store
	GetByNameOrEmail(DataHandler, *models.User, string) error
	// IsName checks if a user name exists in the data store
	IsName(DataHandler, string) (bool, error)
	// IsEmail checks if an email exists in the data store
	IsEmail(DataHandler, string, int) (bool, error)
}

UserReader does reads from user data store

type UserStore

type UserStore interface {
	UserReader
	UserWriter
}

UserStore manages the user data store

type UserWriter

type UserWriter interface {
	// Create adds a new user to the data store
	Create(DataHandler, *models.User) error
	// UpdateEmail updates email address in the data store
	UpdateEmail(DataHandler, string, int) error
	// UpdatePassword updates password in the data store
	UpdatePassword(DataHandler, string, int) error
	// DeleteUser removes user from data store
	DeleteUser(DataHandler, int) error
}

UserWriter does writes to user data store

Directories

Path Synopsis
Godeps
_workspace/src/github.com/DATA-DOG/go-sqlmock
Package sqlmock is a mock library implementing sql driver.
Package sqlmock is a mock library implementing sql driver.
_workspace/src/github.com/gorilla/securecookie
Package gorilla/securecookie encodes and decodes authenticated and optionally encrypted cookie values.
Package gorilla/securecookie encodes and decodes authenticated and optionally encrypted cookie values.
_workspace/src/github.com/jmoiron/sqlx
Package sqlx provides general purpose extensions to database/sql.
Package sqlx provides general purpose extensions to database/sql.
_workspace/src/github.com/jmoiron/sqlx/reflectx
Package reflectx implements extensions to the standard reflect lib suitable for implementing marshaling and unmarshaling packages.
Package reflectx implements extensions to the standard reflect lib suitable for implementing marshaling and unmarshaling packages.
_workspace/src/golang.org/x/crypto/bcrypt
Package bcrypt implements Provos and Mazières's bcrypt adaptive hashing algorithm.
Package bcrypt implements Provos and Mazières's bcrypt adaptive hashing algorithm.
_workspace/src/golang.org/x/crypto/blowfish
Package blowfish implements Bruce Schneier's Blowfish encryption algorithm.
Package blowfish implements Bruce Schneier's Blowfish encryption algorithm.

Jump to

Keyboard shortcuts

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