core

package
v0.0.0-...-12e41be Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2015 License: BSD-3-Clause Imports: 7 Imported by: 0

Documentation

Overview

go-rdb

go-rdb

go-rdb

go-rdb

go-rdb Operator

go-rdb

go-rdb

go-rdb

go-rdb Tuple

go-rdb

go-rdb Value

Index

Constants

View Source
const RowCapacity = 5000
View Source
const TupleCapacity = 100

Variables

View Source
var ErrDifferentType = errors.New("Different type.")
View Source
var ErrUnexpectedAttrNumber = errors.New("Unexpected attribute number.")
View Source
var ErrUnexpectedInputNumber = errors.New("Unexpected input number.")
View Source
var ErrUnkownStreamType = errors.New("unkown stream type")
View Source
var ErrUnkownType = errors.New("Unkown type.")

Functions

func CheckType

func CheckType(s Value) reflect.Kind

func Compare

func Compare(a Value, b Value, operator func(reflect.Kind, Value, reflect.Kind, Value) (bool, error)) bool

func Equal

func Equal(akind reflect.Kind, a Value, bkind reflect.Kind, b Value) (bool, error)

func GreaterThan

func GreaterThan(akind reflect.Kind, a Value, bkind reflect.Kind, b Value) (bool, error)

func LessThan

func LessThan(akind reflect.Kind, a Value, bkind reflect.Kind, b Value) (bool, error)

func NotEqual

func NotEqual(akind reflect.Kind, a Value, bkind reflect.Kind, b Value) (bool, error)

func NotGreaterThan

func NotGreaterThan(akind reflect.Kind, a Value, bkind reflect.Kind, b Value) (bool, error)

func NotLessThan

func NotLessThan(akind reflect.Kind, a Value, bkind reflect.Kind, b Value) (bool, error)

func SearchGreaterThan

func SearchGreaterThan(r *Relation, attr string, key Value, kind reflect.Kind) []int

func SearchLessThan

func SearchLessThan(r *Relation, attr string, key Value, kind reflect.Kind) []int

func SearchMulti

func SearchMulti(r *Relation, attr string, key Value, kind reflect.Kind) []int

func SearchNotGreaterThan

func SearchNotGreaterThan(r *Relation, attr string, key Value, kind reflect.Kind) []int

func SearchNotLessThan

func SearchNotLessThan(r *Relation, attr string, key Value, kind reflect.Kind) []int

Types

type Attr

type Attr struct {
	Name string
	reflect.Kind
}

func (Attr) MarshalJSON

func (a Attr) MarshalJSON() ([]byte, error)

type CrossJoinStream

type CrossJoinStream struct {
	Inputs []Stream `json:"inputs"`
	// contains filtered or unexported fields
}

CrossJoin

func (*CrossJoinStream) Close

func (s *CrossJoinStream) Close()

func (*CrossJoinStream) HasNext

func (s *CrossJoinStream) HasNext() bool

func (*CrossJoinStream) Init

func (s *CrossJoinStream) Init(n *Node) error

func (*CrossJoinStream) Next

func (s *CrossJoinStream) Next() (*Tuple, error)

type FullPath

type FullPath map[string]*Relation

type IndexedOperator

type IndexedOperator func(*Relation, string, Value, reflect.Kind) []int

">": GreaterThan, ">=": NotLessThan, "<": LessThan, "<=": NotGreaterThan, "==": Equal, "!=": NotEqual,

func (*IndexedOperator) UnmarshalJSON

func (ss *IndexedOperator) UnmarshalJSON(data []byte) error

type IndexedSelectionStream

type IndexedSelectionStream struct {
	Input    *Relation       `json:"input"`
	Attr     string          `json:"attr"`
	Selector IndexedOperator `json:"selector"`
	Arg      Value           `json:"arg"`
	// contains filtered or unexported fields
}

Selection

func (*IndexedSelectionStream) Close

func (s *IndexedSelectionStream) Close()

func (*IndexedSelectionStream) HasNext

func (s *IndexedSelectionStream) HasNext() bool

func (*IndexedSelectionStream) Init

func (s *IndexedSelectionStream) Init(n *Node) error

func (*IndexedSelectionStream) Next

func (s *IndexedSelectionStream) Next() (*Tuple, error)

type JoinStream

type JoinStream struct {
	Inputs   []Stream `json:"inputs"`
	Attrs    []string `json:"attrs"`
	Selector Operator `json:"selector"`
	// contains filtered or unexported fields
}

Join

func (*JoinStream) Close

func (s *JoinStream) Close()

func (*JoinStream) HasNext

func (s *JoinStream) HasNext() bool

func (*JoinStream) Init

func (s *JoinStream) Init(n *Node) error

func (*JoinStream) Next

func (s *JoinStream) Next() (result *Tuple, err error)

type Node

type Node struct {
	Name string
	Nodes
	Relations
	FullPath Relations
}

func NewNode

func NewNode(name string) *Node

func (*Node) GetRelation

func (n *Node) GetRelation(fPath string) (*Relation, error)

func (*Node) SearchRelation

func (n *Node) SearchRelation(fPath string) (*Relation, error)

func (*Node) SetRelation

func (n *Node) SetRelation(dir string, rel *Relation) error

func (*Node) SetRelations

func (n *Node) SetRelations(dir string, rels Relations) error

type Nodes

type Nodes map[string]*Node

type Operator

type Operator func(reflect.Kind, Value, reflect.Kind, Value) (bool, error)

func (*Operator) UnmarshalJSON

func (ss *Operator) UnmarshalJSON(data []byte) error

type PhpOptions

type PhpOptions struct {
	KvFmt  bool   `json:"kv,omitempty"`
	MapKey string `json:"map_key,omitempty"`
}
type PhpRelation struct {
	Name  string
	Attrs map[int]string
	Data  map[int]PhpTuple
}

type PhpRelation

type PhpRelation map[interface{}]interface{}

type PhpSchema

type PhpSchema map[interface{}]interface{}

type PhpTuple

type PhpTuple map[interface{}]interface{}

type ProjectionStream

type ProjectionStream struct {
	Input Stream   `json:"input"`
	Attrs []string `json:"attrs"`
}

Projection

func (*ProjectionStream) Close

func (s *ProjectionStream) Close()

func (*ProjectionStream) HasNext

func (s *ProjectionStream) HasNext() bool

func (*ProjectionStream) Init

func (s *ProjectionStream) Init(n *Node) error

func (*ProjectionStream) Next

func (s *ProjectionStream) Next() (result *Tuple, err error)

type Relation

type Relation struct {
	Name  string    `json:"name,omitempty" `
	Attrs *Schema   `json:"attrs"`
	Data  [][]Value `json:"data"`
	// contains filtered or unexported fields
}

func GetRelation

func GetRelation(s Stream, buf [][]Value, n *Node) (*Relation, error)

func StreamToRelation

func StreamToRelation(s Stream, n *Node) (*Relation, error)

func (*Relation) Clone

func (r *Relation) Clone() *Relation

func (*Relation) Close

func (r *Relation) Close()

func (*Relation) CreateIndex

func (r *Relation) CreateIndex()

func (*Relation) HasNext

func (r *Relation) HasNext() bool

func (*Relation) Init

func (r *Relation) Init(root *Node) error

func (*Relation) MarshalPHP

func (r *Relation) MarshalPHP(o PhpOptions) map[interface{}]interface{}

func (*Relation) Next

func (r *Relation) Next() (*Tuple, error)

type Relations

type Relations map[string]*Relation

type RenameStream

type RenameStream struct {
	Input Stream `json:"input"`
	Attr  string `json:"from"`
	Name  string `json:"to"`
}

Rename

func (*RenameStream) Close

func (s *RenameStream) Close()

func (*RenameStream) HasNext

func (s *RenameStream) HasNext() bool

func (*RenameStream) Init

func (s *RenameStream) Init(n *Node) error

func (*RenameStream) Next

func (s *RenameStream) Next() (*Tuple, error)

type Schema

type Schema struct {
	Attrs []Attr
	Index map[string]int `json:"-"`
}

func NewSchema

func NewSchema() *Schema

func (Schema) GetKind

func (s Schema) GetKind(name string) reflect.Kind

func (Schema) MarshalJSON

func (a Schema) MarshalJSON() ([]byte, error)

func (Schema) MarshalPHP

func (a Schema) MarshalPHP(o PhpOptions) map[interface{}]interface{}

type SelectionStream

type SelectionStream struct {
	Input    Stream   `json:"input"`
	Attr     string   `json:"attr"`
	Selector Operator `json:"selector"`
	Arg      Value    `json:"arg"`
	// contains filtered or unexported fields
}

Selection

func (*SelectionStream) Close

func (s *SelectionStream) Close()

func (*SelectionStream) HasNext

func (s *SelectionStream) HasNext() bool

func (*SelectionStream) Init

func (s *SelectionStream) Init(n *Node) error

func (*SelectionStream) Next

func (s *SelectionStream) Next() (*Tuple, error)

type Stream

type Stream struct {
	Relation         *Relation               `json:"relation"`
	IndexedSelection *IndexedSelectionStream `json:"iselection"`
	Selection        *SelectionStream        `json:"selection"`
	Projection       *ProjectionStream       `json:"projection"`
	Rename           *RenameStream           `json:"rename"`
	Union            *UnionStream            `json:"union"`
	Join             *JoinStream             `json:"join"`
	CrossJoin        *CrossJoinStream        `json:"crossjoin"`
	// contains filtered or unexported fields
}

func (*Stream) Init

func (s *Stream) Init(n *Node) error

type Tuple

type Tuple struct {
	*Schema
	Data []Value
}

func NewTuple

func NewTuple() *Tuple

func (*Tuple) Get

func (t *Tuple) Get(attrName string) Value

func (*Tuple) GetAttr

func (t *Tuple) GetAttr(attrName string) Attr

func (*Tuple) MarshalJSON

func (t *Tuple) MarshalJSON() ([]byte, error)

func (*Tuple) MarshalPHP

func (t *Tuple) MarshalPHP(o PhpOptions) map[interface{}]interface{}

func (*Tuple) Set

func (t *Tuple) Set(attr Attr, value Value)

type UnionStream

type UnionStream struct {
	Inputs []Stream `json:"inputs"`
}

Union

func (*UnionStream) Close

func (s *UnionStream) Close()

func (*UnionStream) HasNext

func (s *UnionStream) HasNext() bool

func (*UnionStream) Init

func (s *UnionStream) Init(n *Node) error

func (*UnionStream) Next

func (s *UnionStream) Next() (*Tuple, error)

type Value

type Value interface{}

func VtoFS

func VtoFS(s Value) (reflect.Kind, Value)

Jump to

Keyboard shortcuts

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