service

package
v0.0.0-...-89f0842 Latest Latest
Warning

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

Go to latest
Published: Jun 3, 2017 License: Apache-2.0 Imports: 11 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewCQLCluster

func NewCQLCluster(hosts []string, reconnectInterval time.Duration) *gocql.ClusterConfig

NewCQLCluster generates a new GoSQL config for Cassandra 3, which uses Proto 3

Types

type CQLSession

type CQLSession struct {
	gocql.Session
	// contains filtered or unexported fields
}

func NewCQLSession

func NewCQLSession(cluster *gocql.ClusterConfig) *CQLSession

func (*CQLSession) Finalize

func (s *CQLSession) Finalize()

func (*CQLSession) Initialize

func (s *CQLSession) Initialize()

type CQLTweetRepo

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

func NewCQLTweetRepo

func NewCQLTweetRepo(session *CQLSession, replicationFactor int) *CQLTweetRepo

func (*CQLTweetRepo) All

func (r *CQLTweetRepo) All() ([]model.Tweet, error)

Returns all tweets, from newest to oldest

func (*CQLTweetRepo) CheckReady

func (r *CQLTweetRepo) CheckReady() error

func (*CQLTweetRepo) Create

func (r *CQLTweetRepo) Create(o model.Tweet) (model.Tweet, error)

func (*CQLTweetRepo) Finalize

func (r *CQLTweetRepo) Finalize()

func (*CQLTweetRepo) FindByID

func (r *CQLTweetRepo) FindByID(id string) (model.Tweet, bool, error)

func (*CQLTweetRepo) Initialize

func (r *CQLTweetRepo) Initialize()

type MockTweetRepo

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

MockTweetRepo is an in-memory TweetRepo

func NewMockTweetRepo

func NewMockTweetRepo() *MockTweetRepo

func (*MockTweetRepo) All

func (r *MockTweetRepo) All() ([]model.Tweet, error)

Returns all tweets, from newest to oldest

func (*MockTweetRepo) CheckReady

func (r *MockTweetRepo) CheckReady() error

func (*MockTweetRepo) Create

func (r *MockTweetRepo) Create(o model.Tweet) (model.Tweet, error)

func (*MockTweetRepo) FindByID

func (r *MockTweetRepo) FindByID(id string) (model.Tweet, bool, error)

type Service

type Service interface {
	CheckReady() error
}

type TweetRepo

type TweetRepo interface {
	Service
	Create(model.Tweet) (model.Tweet, error)
	FindByID(id string) (model.Tweet, bool, error)
	All() ([]model.Tweet, error)
}

Jump to

Keyboard shortcuts

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