datalayer

package
v0.0.0-...-532184d Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2018 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Register

func Register(name string, driver DataStore)

Register makes a database driver available by the provided name. If Register is called twice with the same name or if driver is nil, it panics.

Types

type CollectionVM

type CollectionVM struct {
	Name   string
	Schema map[string]interface{}
	Meta   map[string]interface{}
}

type DBConfig

type DBConfig struct {
	DriverType           string `mapstructure:"driver_type"` // eg mongodb, etc
	ConnectionString     string `mapstructure:"connection_string"`
	DatabaseName         string `mapstructure:"database_name"`
	SchemaCollectionName string `mapstructure:"schema_collection_name"` // where schemas will be stored.
}

type DataStore

type DataStore interface {
	Connect(dbConfig DBConfig) (datastore DataStore, err error)
	CreateCollection(ctx context.Context, name string, schema, metadata map[string]interface{}) error
	GetCollections(ctx context.Context) (collections []CollectionVM, err error)
	GetSchema(ctx context.Context, collectionName string) (map[string]interface{}, error)
	SaveItem(ctx context.Context, collectionName, itemID string, item map[string]interface{}) error
	GetItem(ctx context.Context, collectionName, itemID string) (item map[string]interface{}, err error)
	GetItems(ctx context.Context, collectionName string, queryMeta QueryMeta) (items []map[string]interface{}, respInfo ItemsResponseInfo, err error)
}

func Connect

func Connect(name string, dbConfig DBConfig) (DataStore, error)

type ItemsResponseInfo

type ItemsResponseInfo struct{}

type QueryMeta

type QueryMeta struct {
	Page        int
	Count       int
	QueryString string
}

Directories

Path Synopsis
Package mock is a generated GoMock package.
Package mock is a generated GoMock package.

Jump to

Keyboard shortcuts

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