bttest

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Sep 30, 2021 License: Apache-2.0 Imports: 28 Imported by: 0

Documentation

Overview

Package bttest contains test helpers for working with the bigtable package.

To use a Server, create it, and then connect to it with no security: (The project/instance values are ignored.)

srv, err := bttest.NewServer("localhost:0")
...
conn, err := grpc.Dial(srv.Addr, grpc.WithInsecure())
...
client, err := bigtable.NewClient(ctx, proj, instance,
        option.WithGRPCConn(conn))
...

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateTables

func CreateTables(ctx context.Context, db *sql.DB) error

Types

type Item

type Item = btree.Item

type ItemIterator

type ItemIterator = btree.ItemIterator

type Server

type Server struct {
	Addr string
	// contains filtered or unexported fields
}

Server is an in-memory Cloud Bigtable fake. It is unauthenticated, and only a rough approximation.

func NewServer

func NewServer(laddr string, db *sql.DB, opt ...grpc.ServerOption) (*Server, error)

NewServer creates a new Server. The Server will be listening for gRPC connections, without TLS, on the provided address. The resolved address is named by the Addr field.

func (*Server) Close

func (s *Server) Close()

Close shuts down the server.

type SqlRows

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

SqlRows is a backend modeled on the github.com/google/btree interface all errors are considered fatal

rows are persisted in rows_t

func NewSqlRows

func NewSqlRows(db *sql.DB, parent, tableId string) *SqlRows

func (*SqlRows) Ascend

func (db *SqlRows) Ascend(iterator ItemIterator)

func (*SqlRows) AscendGreaterOrEqual

func (db *SqlRows) AscendGreaterOrEqual(pivot Item, iterator ItemIterator)

func (*SqlRows) AscendLessThan

func (db *SqlRows) AscendLessThan(pivot Item, iterator ItemIterator)

func (*SqlRows) AscendRange

func (db *SqlRows) AscendRange(greaterOrEqual, lessThan Item, iterator ItemIterator)

func (*SqlRows) Delete

func (db *SqlRows) Delete(item Item)

func (*SqlRows) DeleteAll

func (db *SqlRows) DeleteAll()

func (*SqlRows) Get

func (db *SqlRows) Get(key Item) Item

func (*SqlRows) Len

func (db *SqlRows) Len() int

func (*SqlRows) ReplaceOrInsert

func (db *SqlRows) ReplaceOrInsert(item Item) Item

type SqlTables

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

SqlTables persists tables to tables_t

func NewSqlTables

func NewSqlTables(db *sql.DB) *SqlTables

func (*SqlTables) Delete

func (db *SqlTables) Delete(t *table)

func (*SqlTables) Get

func (db *SqlTables) Get(parent, tableId string) *table

func (*SqlTables) GetAll

func (db *SqlTables) GetAll() []*table

func (*SqlTables) Save

func (db *SqlTables) Save(t *table)

Jump to

Keyboard shortcuts

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