pgstorage

package
v0.0.0-...-49e5460 Latest Latest
Warning

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

Go to latest
Published: Feb 22, 2019 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DoQuery

func DoQuery(ctx context.Context, db *sql.DB, query string, colAddrs []ColAddr, args ...interface{}) ([]record.Record, error)

func DoStreamQuery

func DoStreamQuery(ctx context.Context, db *sql.DB, query string, colAddrs []ColAddr, args ...interface{}) (stream.ClientStream, error)

Types

type ColAddr

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

ColAddr is a list of addresses of columns

type Storage

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

func (*Storage) AddCollection

func (s *Storage) AddCollection(ctx context.Context, db *metadata.Database, shardInstance *metadata.ShardInstance, collection *metadata.Collection) error

Collection Changes

func (*Storage) AddCollectionField

func (s *Storage) AddCollectionField(ctx context.Context, db *metadata.Database, shardinstance *metadata.ShardInstance, collection *metadata.Collection, field *metadata.CollectionField) error

CONSTRAINT collection_field_parent_collection_field_id_fkey FOREIGN KEY (parent_collection_field_id)

REFERENCES public.collection_field (_id) MATCH SIMPLE
ON UPDATE NO ACTION ON DELETE NO ACTION

func (*Storage) AddCollectionIndex

func (s *Storage) AddCollectionIndex(ctx context.Context, db *metadata.Database, shardInstance *metadata.ShardInstance, collection *metadata.Collection, index *metadata.CollectionIndex) error

Index changes

func (*Storage) AddDatabase

func (s *Storage) AddDatabase(ctx context.Context, db *metadata.Database) error

Database changes

func (*Storage) AddShardInstance

func (s *Storage) AddShardInstance(ctx context.Context, db *metadata.Database, shardInstance *metadata.ShardInstance) error

func (*Storage) Aggregate

func (s *Storage) Aggregate(ctx context.Context, args query.QueryArgs) *query.Result

func (*Storage) Delete

func (s *Storage) Delete(ctx context.Context, args query.QueryArgs) *query.Result

func (*Storage) Filter

func (s *Storage) Filter(ctx context.Context, args query.QueryArgs) *query.Result

func (*Storage) FilterStream

func (s *Storage) FilterStream(ctx context.Context, args query.QueryArgs) *query.ResultStream

TODO: combine filter & filterStream query generation (they are literally a copy/paste up until the actual query execution)

func (*Storage) Get

func (s *Storage) Get(ctx context.Context, args query.QueryArgs) *query.Result

Do a single item get

func (*Storage) GetCollection

func (s *Storage) GetCollection(ctx context.Context, dbname, shardinstance, collectionname string) *metadata.Collection

func (*Storage) GetCollectionField

func (s *Storage) GetCollectionField(ctx context.Context, dbname, shardinstance, collectionname, fieldname string) *metadata.CollectionField

TODO: better

func (*Storage) GetCollectionIndex

func (s *Storage) GetCollectionIndex(ctx context.Context, dbname, shardinstance, collectionname, indexname string) *metadata.CollectionIndex

func (*Storage) GetDatabase

func (s *Storage) GetDatabase(ctx context.Context, dbname string) *metadata.Database

func (*Storage) GetMeta

func (s *Storage) GetMeta() *metadata.Meta

TODO: remove

func (*Storage) GetShardInstance

func (s *Storage) GetShardInstance(ctx context.Context, dbname, shardinstance string) *metadata.ShardInstance

func (*Storage) Init

func (s *Storage) Init(metaFunc metadata.MetaFunc, c map[string]interface{}) error

func (*Storage) Insert

func (s *Storage) Insert(ctx context.Context, args query.QueryArgs) *query.Result

func (*Storage) InsertMany

func (s *Storage) InsertMany(ctx context.Context, args query.QueryArgs) *query.Result

func (*Storage) ListCollection

func (s *Storage) ListCollection(ctx context.Context, dbname, shardinstance string) []*metadata.Collection

TODO: nicer, this works but is way more work than necessary

func (*Storage) ListCollectionField

func (s *Storage) ListCollectionField(ctx context.Context, dbname, shardinstance, collectionname string) []*metadata.CollectionField

func (*Storage) ListCollectionIndex

func (s *Storage) ListCollectionIndex(ctx context.Context, dbname, shardInstance, collectionname string) []*metadata.CollectionIndex

func (*Storage) ListDatabase

func (s *Storage) ListDatabase(ctx context.Context) []*metadata.Database

func (*Storage) ListShardInstance

func (s *Storage) ListShardInstance(ctx context.Context, dbname string) []*metadata.ShardInstance

func (*Storage) RemoveCollection

func (s *Storage) RemoveCollection(ctx context.Context, dbname, shardinstance, collectionname string) error

TODO: use db listing to remove things TODO: remove indexes on removal

func (*Storage) RemoveCollectionField

func (s *Storage) RemoveCollectionField(ctx context.Context, dbname, shardinstance, collectionname, fieldName string) error

func (*Storage) RemoveCollectionIndex

func (s *Storage) RemoveCollectionIndex(ctx context.Context, dbname, shardinstance, collectionname, indexname string) error

TODO: index names have to be unique across the whole DB?

func (*Storage) RemoveDatabase

func (s *Storage) RemoveDatabase(ctx context.Context, dbname string) error

func (*Storage) RemoveShardInstance

func (s *Storage) RemoveShardInstance(ctx context.Context, dbname, shardInstance string) error

func (*Storage) Set

func (s *Storage) Set(ctx context.Context, args query.QueryArgs) *query.Result

Set() is a special-case of "upsert" where we do the upsert on the primary key

func (*Storage) Update

func (s *Storage) Update(ctx context.Context, args query.QueryArgs) *query.Result

type StorageConfig

type StorageConfig struct {
	// How to connect to postgres
	PGString        string         `yaml:"pg_string"`
	MaxIdleConns    *int           `yaml:"max_idle_conns"`
	MaxOpenConns    *int           `yaml:"max_open_conns"`
	ConnMaxLifetime *time.Duration `yaml:"conn_max_lifetime"`
}

Jump to

Keyboard shortcuts

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