rqc

package module
v0.0.0-...-35f8856 Latest Latest
Warning

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

Go to latest
Published: Jun 25, 2015 License: MIT Imports: 4 Imported by: 0

README

rqc

Build status

Redis query compiler (rqc) generates lua scripts to execute selection queries on redis sets.

Still under development.

Installation

go get github.com/mmcloughlin/rqc

Usage

Create a query builder with

builder := Builder{
	Conn:      conn,
	Namespace: "queries",
}

Here Conn is expected to be a redigo redis connection. Namespace is a prefix for all intermediate keys produced in query execution.

Acknowledgements

There are a few similar projects out there and I learned a lot from digging around in their source code:

  • Zoom is an awesome library that offers similar funtionality at a higher level

  • django redis engine also contains very similar ideas

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Builder

type Builder struct {
	Conn redis.Conn

	// Namespace is a key prefix for intermediate keys constructed by the
	// builder.
	Namespace string
}

func (*Builder) Key

func (b *Builder) Key(name string) string

func (*Builder) Select

func (b *Builder) Select(key string) *Selection

type Range

type Range struct {
	Min float64
	Max float64
}

func Gt

func Gt(bound float64) Range

func Lt

func Lt(bound float64) Range

func (Range) String

func (r Range) String() string

type Selection

type Selection struct {
	Builder          *Builder
	BaseKey          string
	ResultKey        string
	IntersectionKeys []string
	Code             []string
}

func (*Selection) Complement

func (s *Selection) Complement(key string) *Selection

func (*Selection) Filter

func (s *Selection) Filter(key string, r Range) *Selection

func (*Selection) Generate

func (s *Selection) Generate() string

func (*Selection) Intersect

func (s *Selection) Intersect(key string) *Selection

Intersect specifies another set key to intersect with.

func (*Selection) Run

func (s *Selection) Run()

func (*Selection) Script

func (s *Selection) Script() *redis.Script

Jump to

Keyboard shortcuts

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