datastore

package
v0.0.0-...-a18f44e Latest Latest
Warning

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

Go to latest
Published: Sep 16, 2016 License: MIT Imports: 25 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DataSourceLabel = "google-datastore"
)

Variables

View Source
var (
	GoogleJwt     *string = flag.String("googlejwt", os.Getenv("GOOGLEJWT"), "Path to google JWT oauth token file")
	GoogleProject *string = flag.String("googleproject", os.Getenv("GOOGLEPROJECT"), "Google Datastore Project Id")

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

Functions

This section is empty.

Types

type DatastoreMutator

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

type GoogleDSDataSource

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

Google Datastore Data Source, is a singleton, non-threadsafe connection

to a backend mongo server

func (*GoogleDSDataSource) Close

func (m *GoogleDSDataSource) Close() error

func (*GoogleDSDataSource) DataSource

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

func (*GoogleDSDataSource) Open

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

func (*GoogleDSDataSource) Setup

func (*GoogleDSDataSource) Table

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

func (*GoogleDSDataSource) Tables

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

type ResultReader

type ResultReader struct {
	*exec.TaskBase

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

Google Datastore ResultReader implements result paging, reading - 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

Runs the Google Datastore properties into

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

as well as making a projection, ie column selection

func (m *ResultReader) Finalize() error {

type ResultReaderNext

type ResultReaderNext struct {
	*ResultReader
}

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
}

Sql To Google Datastore Maps a Sql request into an equivalent

google data store query

- a dialect translator

func NewSqlToDatstore

func NewSqlToDatstore(table *schema.Table, cl *datastore.Client, ctx context.Context) *SqlToDatstore

NewSqlToDatastore 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)

interface for SourceMutation CreateMutator(stmt expr.SqlStatement) (Mutator, error)

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)

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)

func (*SqlToDatstore) WalkSourceSelect

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

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
-

Jump to

Keyboard shortcuts

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