helpers

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Dec 17, 2019 License: Apache-2.0 Imports: 6 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RedisClient

func RedisClient() *redis.Client

RedisClient returns a redis client to the URL specified in the REDIS_URL env var

func SeedTestDB

func SeedTestDB(records DBData) *mgo.Database

SeedTestDB clears the testing DB and then re-seeds it with the given records. Returns an mgo.Database for doing any additional setup or assertions.

The givens records is a map of [collection name] -> [array of records]

func SortOTRMessagesByID

func SortOTRMessagesByID(msgs []OTRMessage)

SortOTRMessagesByID sorts a slice of OTRMessage by ID (for order-insensitive comparisons)

Types

type DBData

type DBData map[string][]bson.M

DBData is a map of [collection name] -> [array of bson.M records]

type OTRMessage

type OTRMessage struct {
	Event    string                 `json:"e"`
	Document map[string]interface{} `json:"d"`
	Fields   []string               `json:"f"`
}

OTRMessage is a message published by OTR to Redis

Jump to

Keyboard shortcuts

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