store

package
v0.0.0-...-a45123f Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2014 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const KvSchema = `
CREATE TABLE IF NOT EXISTS %s (
	k	varchar(255) NOT NULL,
	v	BLOB,
	PRIMARY KEY(k)
);
`

Variables

View Source
var ConfigTable = "config"
View Source
var Debug bool

Functions

func Get

func Get(table, key string) (string, error)

func Set

func Set(table, key, data string) (err error)

Types

type Broadcast

type Broadcast struct {
	*Queue
	DB *DB
}

Broadcast wraps a queue and uses a db as a initial source

func (*Broadcast) Init

func (b *Broadcast) Init(table, key string, private bool) (int64, chan string)

Init calls Subscribe, and then loads data from the shared table at key then it'll send the data over the channel

type DB

type DB struct{ *sqlx.DB }

func NewDB

func NewDB() (db *DB)

func (*DB) CheckTable

func (d *DB) CheckTable(table, schema string) error

func (*DB) Close

func (d *DB) Close()

func (*DB) Get

func (d *DB) Get(table, key string) (string, error)

func (*DB) Set

func (d *DB) Set(table, key, data string) (err error)

type Queue

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

func NewQueue

func NewQueue() *Queue

func (*Queue) Blacklist

func (q *Queue) Blacklist(keys ...string)

func (*Queue) Subscribe

func (q *Queue) Subscribe(key string, private bool) (int64, chan string)

func (*Queue) Unsubscribe

func (q *Queue) Unsubscribe(id int64)

func (*Queue) Update

func (q *Queue) Update(key, val string, private bool)

Jump to

Keyboard shortcuts

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