base

package
v1.22.0 Latest Latest
Warning

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

Go to latest
Published: Aug 10, 2021 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// PreC is the prefix for Column
	PreC = "C:"
	// PreE is the prefix for Entity
	PreE = "E:"
	// Arrow is the symbol in schema mapping between table name and table column
	Arrow = "->"
	// TypeOf represents "typeOf" literal
	TypeOf = "typeOf"
	// Triple represents Triples table name
	Triple = "Triple"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Column

type Column struct {
	// Spanner column name.
	Name string
	// The spanner table this column belongs to.
	Table Table
}

Column represents a column in schema mapping.

func NewColumn

func NewColumn(s string, db string) (*Column, error)

NewColumn creates a new Column instance.

func (Column) Key

func (c Column) Key() string

Key gets the key of a column.

func (Column) String

func (c Column) String() string

type Entity

type Entity struct {
	// Entity ID like "E1", "E2"
	ID string
	// The spanner table this entity belongs to.
	Table Table
}

Entity represents node entity referenced in schema mapping.

func NewEntity

func NewEntity(s string, db string) (*Entity, error)

NewEntity creates a new Entity instance.

func (Entity) Key

func (e Entity) Key() string

Key gets the key of an entity.

func (Entity) String

func (e Entity) String() string

type FuncDeps

type FuncDeps struct {
}

FuncDeps represents the functional deps predicate.

type Mapping

type Mapping struct {
	// Predicate could be a string value or an Entity.
	Pred interface{}
	// Subject is a table entity.
	Sub Entity
	// Object indicates the column of the entity.
	Obj interface{}
}

Mapping represents a schema mapping statement.

func NewMapping

func NewMapping(pred, sub, obj, db string) (*Mapping, error)

NewMapping creates a new Mapping instance.

func (*Mapping) IsTriple

func (q *Mapping) IsTriple() bool

IsTriple checks if a mapping is about Triples table.

type Node

type Node struct {
	// Alias of a node in datalog query, should start with "?".
	Alias string
}

Node represents a reference of a graph node in datalog query.

func NewNode

func NewNode(nodeAlias string) Node

NewNode creates a new Node instance.

func (Node) String

func (n Node) String() string

type Query

type Query struct {
	// Query predicate is a string of schema.
	Pred string
	// Query subject is a node.
	Sub Node
	// Query object is a node or string.
	Obj interface{}
}

Query represents a datalog query statement.

func NewQuery

func NewQuery(pred string, nodeAlias string, obj interface{}) *Query

NewQuery creates a new Query instance.

func (*Query) IsTypeOf

func (q *Query) IsTypeOf() bool

IsTypeOf checks if a query is typeOf statement.

type QueryOptions

type QueryOptions struct {
	Limit    int
	Db       string
	Prov     bool
	Distinct bool
	Orderby  string
	ASC      bool
}

QueryOptions contains options for query.

type Table

type Table struct {
	// Spanner table name.
	Name string
	// Id used to distinguish same table when self join.
	ID string
}

Table represents a spanner table in through translation process

func (Table) Alias

func (t Table) Alias() string

Alias gets table's alias used in SQL query.

func (Table) String

func (t Table) String() string

Jump to

Keyboard shortcuts

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