datastore

package
v0.15.5 Latest Latest
Warning

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

Go to latest
Published: Aug 10, 2018 License: MIT Imports: 24 Imported by: 3

Documentation

Overview

Package datastore is a source adapter for Google DataStore into dataux to allow mysql querying against datastore.

Index

Constants

View Source
const (
	// SourceType is the Type label for global source type registery.
	SourceType = "google-datastore"
)

Variables

View Source
var (
	// DefaultLimit LIMIT on DataStore Queries
	DefaultLimit = 1000
)
View Source
var (
	// ErrNoSchema no schema found for datastore
	ErrNoSchema = fmt.Errorf("No schema or configuration exists")
)

Functions

This section is empty.

Types

type DatastoreMutator

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

DatastoreMutator is a connection for mutation

type ResultReader

type ResultReader struct {
	*exec.TaskBase

	Vals  [][]driver.Value
	Total int
	Req   *SQLToDatstore
	// contains filtered or unexported fields
}

ResultReader for Google Datastore implements result paging, reading from datastore types into generic sql types - driver.Rows

func NewResultReader

func NewResultReader(req *SQLToDatstore) *ResultReader

func (*ResultReader) Close

func (m *ResultReader) Close() error

func (*ResultReader) Run

func (m *ResultReader) Run() error

Run takes sql query which has been translated into a google datastore the Google Datastore properties into

[][]interface{}   which is compabitble with sql/driver values

as well as making a projection, ie column selection

type ResultReaderNext

type ResultReaderNext struct {
	*ResultReader
}

ResultReaderNext A wrapper, allowing us to implement sql/driver Next() interface

which is different than qlbridge/datasource Next()

type Row

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

func (*Row) Load

func (m *Row) Load(props []datastore.Property) error

func (*Row) Save

func (m *Row) Save() ([]datastore.Property, error)

func (*Row) Vals

func (m *Row) Vals(cols map[string]int) []driver.Value

type SQLToDatstore

type SQLToDatstore struct {
	*exec.TaskBase
	// contains filtered or unexported fields
}

SQLToDatstore transforms a Sql AST statement into a Google Datastore request - a dialect translator (sql -> datastore query languages) - matches Task interface to operate in qlbridge exec interfaces

func NewSQLToDatstore

func NewSQLToDatstore(table *schema.Table, cl *datastore.Client, ctx context.Context) *SQLToDatstore

NewSQLToDatstore Create a new translator to re-write a SQL AST query into google data store

func (*SQLToDatstore) CreateMutator

func (m *SQLToDatstore) CreateMutator(pc interface{}) (schema.ConnMutator, error)

CreateMutator interface allowing a connection for mutation.

func (*SQLToDatstore) Delete

func (m *SQLToDatstore) Delete(key driver.Value) (int, error)

func (*SQLToDatstore) DeleteExpression

func (m *SQLToDatstore) DeleteExpression(pln interface{}, where expr.Node) (int, error)

func (*SQLToDatstore) Put

func (m *SQLToDatstore) Put(ctx context.Context, key schema.Key, val interface{}) (schema.Key, error)

Put interface for Upsert.Put()

func (*SQLToDatstore) PutMulti

func (m *SQLToDatstore) PutMulti(ctx context.Context, keys []schema.Key, src interface{}) ([]schema.Key, error)

func (*SQLToDatstore) WalkExecSource

func (m *SQLToDatstore) WalkExecSource(p *plan.Source) (exec.Task, error)

WalkExecSource part of planner interface allowing sources to do their own execution planning.

func (*SQLToDatstore) WalkSourceSelect

func (m *SQLToDatstore) WalkSourceSelect(planner plan.Planner, p *plan.Source) (plan.Task, error)

WalkSourceSelect part of planner interface for source.

func (*SQLToDatstore) WalkWhereNode

func (m *SQLToDatstore) WalkWhereNode(cur expr.Node) error

WalkWhereNode an expression, and its AND logic to create an appropriately request for google datastore queries

Limititations of Google Datastore - https://cloud.google.com/datastore/docs/concepts/queries#Datastore_Restrictions_on_queries - no OR filters

type Source

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

Source Google Datastore Data Source, is a singleton, non-threadsafe source to a create connections/clients to datastore

func (*Source) Close

func (m *Source) Close() error

func (*Source) DataSource

func (m *Source) DataSource() schema.Source

func (*Source) Init

func (m *Source) Init()

Init init the source

func (*Source) Open

func (m *Source) Open(tableName string) (schema.Conn, error)

func (*Source) Setup

func (m *Source) Setup(ss *schema.Schema) error

Setup the source.

func (*Source) Table

func (m *Source) Table(table string) (*schema.Table, error)

Table get table schema.

func (*Source) Tables

func (m *Source) Tables() []string

Jump to

Keyboard shortcuts

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