db

package
v0.0.0-...-d1236c8 Latest Latest
Warning

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

Go to latest
Published: May 7, 2016 License: BSD-3-Clause Imports: 9 Imported by: 12

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

func NewClient

func NewClient(config *Config) *Client

func (*Client) Connect

func (c *Client) Connect() error

func (*Client) Disconnect

func (c *Client) Disconnect()

func (*Client) WipeDb

func (c *Client) WipeDb() error

type Config

type Config struct {
	DbURL  string
	DbName string
}

func NewConfig

func NewConfig() *Config

type OfferGroupPosts

type OfferGroupPosts interface {
	Insert(...*model.OfferGroupPost) ([]*model.OfferGroupPost, error)
	UpdateByID(bson.ObjectId, *model.OfferGroupPost) error
	GetByID(bson.ObjectId) (*model.OfferGroupPost, error)
	GetByDate(model.DateWithoutTime, bson.ObjectId) (*model.OfferGroupPost, error)
}

func NewOfferGroupPosts

func NewOfferGroupPosts(c *Client) OfferGroupPosts

type Offers

type Offers interface {
	Insert(...*model.Offer) ([]*model.Offer, error)
	GetForRegion(region string, startTime, endTime time.Time) ([]*model.Offer, error)
	GetNear(loc geo.Location, startTime, endTime time.Time) ([]*model.OfferWithDistance, error)
	GetForRestaurant(restaurantID bson.ObjectId, startTime time.Time) ([]*model.Offer, error)
	GetSimilarTitlesForRestaurant(restaurantID bson.ObjectId, partialTitle string) ([]string, error)
	GetForRestaurantByTitle(restaurantID bson.ObjectId, title string) (*model.Offer, error)
	GetForRestaurantWithinTimeBounds(restaurantID bson.ObjectId, startTime, endTime time.Time) ([]*model.Offer, error)
	UpdateID(bson.ObjectId, *model.Offer) error
	GetID(bson.ObjectId) (*model.Offer, error)
	RemoveID(bson.ObjectId) error
}

func NewOffers

func NewOffers(c *Client) (Offers, error)

type RegionIter

type RegionIter interface {
	Close() error
	Next(*model.Region) bool
}

RegionIter is a wrapper around *mgo.Iter that allows type safe iteration

type Regions

type Regions interface {
	Insert(...*model.Region) error
	GetName(string) (*model.Region, error)
	GetAll() RegionIter
	UpdateName(string, *model.Region) error
}

func NewRegions

func NewRegions(client *Client) Regions

type RegistrationAccessTokens

type RegistrationAccessTokens interface {
	Insert(*model.RegistrationAccessToken) (*model.RegistrationAccessToken, error)
	Exists(model.Token) (bool, error)
}

func NewRegistrationAccessTokens

func NewRegistrationAccessTokens(c *Client) (RegistrationAccessTokens, error)

type RestaurantIter

type RestaurantIter interface {
	Close() error
	Next(*model.Restaurant) bool
}

RestaurantIter is a wrapper around *mgo.Iter that allows type safe iteration

type Restaurants

type Restaurants interface {
	Insert(...*model.Restaurant) ([]*model.Restaurant, error)
	GetAll() RestaurantIter
	GetByIDs([]bson.ObjectId) ([]*model.Restaurant, error)
	GetByFacebookPageIDs([]string) ([]*model.Restaurant, error)
	GetID(bson.ObjectId) (*model.Restaurant, error)
	Exists(name string) (bool, error)
	UpdateID(bson.ObjectId, *model.Restaurant) error
}

func NewRestaurants

func NewRestaurants(client *Client) Restaurants

type TagIter

type TagIter interface {
	Close() error
	Next(*model.Tag) bool
}

TagIter is a wrapper around *mgo.Iter that allows type safe iteration

type Tags

type Tags interface {
	Insert(...*model.Tag) error
	GetName(string) (*model.Tag, error)
	GetAll() TagIter
	UpdateName(string, *model.Tag) error
}

func NewTags

func NewTags(client *Client) Tags

type UserIter

type UserIter interface {
	Close() error
	Next(*model.User) bool
}

UserIter is a wrapper around *mgo.Iter that allows type safe iteration

type Users

type Users interface {
	Insert(...*model.User) error
	GetFbID(string) (*model.User, error)
	GetSessionID(string) (*model.User, error)
	GetAll() UserIter
	Update(string, *model.User) error
	SetAccessToken(string, oauth2.Token) error
	SetPageAccessTokens(string, []model.FacebookPageToken) error
	SetSessionID(bson.ObjectId, string) error
	UnsetSessionID(bson.ObjectId) error
}

func NewUsers

func NewUsers(client *Client) Users

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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