storage

package
v0.0.0-...-fcabd6b Latest Latest
Warning

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

Go to latest
Published: Oct 5, 2015 License: MIT Imports: 0 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Register

func Register(driverType string, factory driverFactory)

Types

type App

type App struct {
	ID  string    `json:"id"`
	GCM GCMConfig `json:"gcm"`
}

App holds app data.

type Device

type Device struct {
	Platform  string
	Token     string
	CreatedAt int
}

Device holds device data.

type GCMConfig

type GCMConfig struct {
	APIKey    string `json:"apiKey"`
	ProjectID string `json:"projectId"`
}

GCMConfig holds GCM(Google Cloud Messaging) data.

type Storage

type Storage interface {

	// PutApp creates a new app or updates existing one.
	PutApp(app *App) error

	// GetApp gets an app's data.
	GetApp(appID string) (*App, error)

	// AddSubscriberDevice adds new device to subscriber.
	AddSubscriberDevice(appID string, subscriberID string, device *Device) error

	// UpdateDeviceToken updates token of a subscriber's device.
	UpdateDeviceToken(appID string, subscriberID string, oldDeviceToken string, newDeviceToken string) error

	// GetSubscriberDevices gets devices of a subscriber.
	GetSubscriberDevices(appID string, subscriberID string) ([]*Device, error)

	// AddSubscriber adds new subscriber to channel.
	AddSubscriber(appID string, channelID string, subscriberIDs []string) error

	// AddChannel adds new channel to app.
	AddChannel(appID string, channelID string) error

	// DeleteChannel deletes channel and its subscribers from app.
	DeleteChannel(appID string, channelID string) error

	// GetChannelSubscribers gets subscribers of a channel.
	GetChannelSubscribers(appID string, channelID string) ([]string, error)
}

func Init

func Init(driverType string, options map[string]interface{}) Storage

Directories

Path Synopsis
drivers

Jump to

Keyboard shortcuts

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