backends

package
v3.0.8 Latest Latest
Warning

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

Go to latest
Published: Sep 28, 2018 License: LGPL-2.1 Imports: 51 Imported by: 4

Documentation

Index

Constants

View Source
const (
	FormatYAML SerializationFormat = `yaml`
	FormatJSON                     = `json`
	FormatCSV                      = `csv`
)
View Source
const DefaultFilesystemRecordSubdirectory = `data`

Variables

View Source
var BleveBatchFlushCount = 1
View Source
var BleveBatchFlushInterval = 10 * time.Second
View Source
var BleveIdentityField = `_id`
View Source
var DefaultAmazonRegion = `us-east-1`
View Source
var DefaultAutoregister = false
View Source
var DefaultCompoundJoiner = `:`
View Source
var DefaultConnectTimeout = 10 * time.Second
View Source
var ElasticsearchBatchFlushCount = 1
View Source
var ElasticsearchBatchFlushInterval = 10 * time.Second
View Source
var ElasticsearchConnectTimeout = 3 * time.Second
View Source
var ElasticsearchDocumentType = `document`
View Source
var ElasticsearchIdentityField = `_id`
View Source
var ElasticsearchRequestTimeout = 30 * time.Second
View Source
var ElasticsearchResponseHeaderTimeout = 10 * time.Second
View Source
var ElasticsearchTLSTimeout = 10 * time.Second
View Source
var FilesystemRecordCacheSize = 1024
View Source
var IndexerPageSize int = 100
View Source
var IndexerResultsStop = fmt.Errorf(`stop indexer results`)
View Source
var InitialPingTimeout = time.Duration(10) * time.Second
View Source
var MaxFacetCardinality int = 10000
View Source
var MongoIdentityField = `_id`
View Source
var NotImplementedError = fmt.Errorf("Not Implemented")
View Source
var RecordCacheEnabled = false
View Source
var RedisDefaultAddress = `localhost:6379`
View Source
var RedisDefaultProtocol = `tcp`
View Source
var WriteLockFormat = `%s.lock`

Functions

func DefaultQueryImplementation

func DefaultQueryImplementation(indexer Indexer, collection *dal.Collection, f *filter.Filter, resultFns ...IndexResultFunc) (*dal.RecordSet, error)

func InflateEmbeddedRecords

func InflateEmbeddedRecords(backend Backend, parent *dal.Collection, record *dal.Record, prepId func(interface{}) interface{}) error

func PopulateRecordSetPageDetails

func PopulateRecordSetPageDetails(recordset *dal.RecordSet, f *filter.Filter, page IndexPage)

func RegisterBackend

func RegisterBackend(name string, fn BackendFunc)

Types

type Aggregator

type Aggregator interface {
	AggregatorConnectionString() *dal.ConnectionString
	AggregatorInitialize(Backend) error
	Sum(collection *dal.Collection, field string, f ...*filter.Filter) (float64, error)
	Count(collection *dal.Collection, f ...*filter.Filter) (uint64, error)
	Minimum(collection *dal.Collection, field string, f ...*filter.Filter) (float64, error)
	Maximum(collection *dal.Collection, field string, f ...*filter.Filter) (float64, error)
	Average(collection *dal.Collection, field string, f ...*filter.Filter) (float64, error)
	GroupBy(collection *dal.Collection, fields []string, aggregates []filter.Aggregate, f ...*filter.Filter) (*dal.RecordSet, error)
}

type Backend

type Backend interface {
	Initialize() error
	SetIndexer(dal.ConnectionString) error
	RegisterCollection(*dal.Collection)
	GetConnectionString() *dal.ConnectionString
	Exists(collection string, id interface{}) bool
	Retrieve(collection string, id interface{}, fields ...string) (*dal.Record, error)
	Insert(collection string, records *dal.RecordSet) error
	Update(collection string, records *dal.RecordSet, target ...string) error
	Delete(collection string, ids ...interface{}) error
	CreateCollection(definition *dal.Collection) error
	DeleteCollection(collection string) error
	ListCollections() ([]string, error)
	GetCollection(collection string) (*dal.Collection, error)
	WithSearch(collection *dal.Collection, filters ...*filter.Filter) Indexer
	WithAggregator(collection *dal.Collection) Aggregator
	Flush() error
	Ping(time.Duration) error
	String() string
}

func MakeBackend

func MakeBackend(connection dal.ConnectionString) (Backend, error)

func NewDynamoBackend

func NewDynamoBackend(connection dal.ConnectionString) Backend

func NewFilesystemBackend

func NewFilesystemBackend(connection dal.ConnectionString) Backend

func NewMongoBackend

func NewMongoBackend(connection dal.ConnectionString) Backend

func NewRedisBackend

func NewRedisBackend(connection dal.ConnectionString) Backend

func NewSqlBackend

func NewSqlBackend(connection dal.ConnectionString) Backend

type BackendFunc

type BackendFunc func(dal.ConnectionString) Backend

type BleveIndexer

type BleveIndexer struct {
	Indexer
	// contains filtered or unexported fields
}

func NewBleveIndexer

func NewBleveIndexer(connection dal.ConnectionString) *BleveIndexer

func (*BleveIndexer) DeleteQuery

func (self *BleveIndexer) DeleteQuery(collection *dal.Collection, f *filter.Filter) error

func (*BleveIndexer) FlushIndex

func (self *BleveIndexer) FlushIndex() error

func (*BleveIndexer) GetBackend

func (self *BleveIndexer) GetBackend() Backend

func (*BleveIndexer) Index

func (self *BleveIndexer) Index(collection *dal.Collection, records *dal.RecordSet) error

func (*BleveIndexer) IndexConnectionString

func (self *BleveIndexer) IndexConnectionString() *dal.ConnectionString

func (*BleveIndexer) IndexExists

func (self *BleveIndexer) IndexExists(collection *dal.Collection, id interface{}) bool

func (*BleveIndexer) IndexInitialize

func (self *BleveIndexer) IndexInitialize(parent Backend) error

func (*BleveIndexer) IndexRemove

func (self *BleveIndexer) IndexRemove(collection *dal.Collection, ids []interface{}) error

func (*BleveIndexer) IndexRetrieve

func (self *BleveIndexer) IndexRetrieve(collection *dal.Collection, id interface{}) (*dal.Record, error)

func (*BleveIndexer) ListValues

func (self *BleveIndexer) ListValues(collection *dal.Collection, fields []string, f *filter.Filter) (map[string][]interface{}, error)

func (*BleveIndexer) Query

func (self *BleveIndexer) Query(collection *dal.Collection, f *filter.Filter, resultFns ...IndexResultFunc) (*dal.RecordSet, error)

func (*BleveIndexer) QueryFunc

func (self *BleveIndexer) QueryFunc(collection *dal.Collection, f *filter.Filter, resultFn IndexResultFunc) error

type CachingBackend

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

func NewCachingBackend

func NewCachingBackend(parent Backend) *CachingBackend

func (*CachingBackend) CreateCollection

func (self *CachingBackend) CreateCollection(definition *dal.Collection) error

func (*CachingBackend) Delete

func (self *CachingBackend) Delete(collection string, ids ...interface{}) error

func (*CachingBackend) DeleteCollection

func (self *CachingBackend) DeleteCollection(collection string) error

func (*CachingBackend) Exists

func (self *CachingBackend) Exists(collection string, id interface{}) bool

passthrough the remaining functions to fulfill the Backend interface -------------------------------------------------------------------------------------------------

func (*CachingBackend) Flush

func (self *CachingBackend) Flush() error

func (*CachingBackend) GetCollection

func (self *CachingBackend) GetCollection(collection string) (*dal.Collection, error)

func (*CachingBackend) GetConnectionString

func (self *CachingBackend) GetConnectionString() *dal.ConnectionString

func (*CachingBackend) Initialize

func (self *CachingBackend) Initialize() error

func (*CachingBackend) Insert

func (self *CachingBackend) Insert(collection string, records *dal.RecordSet) error

func (*CachingBackend) ListCollections

func (self *CachingBackend) ListCollections() ([]string, error)

func (*CachingBackend) Ping

func (self *CachingBackend) Ping(d time.Duration) error

func (*CachingBackend) RegisterCollection

func (self *CachingBackend) RegisterCollection(c *dal.Collection)

func (*CachingBackend) ResetCache

func (self *CachingBackend) ResetCache()

func (*CachingBackend) Retrieve

func (self *CachingBackend) Retrieve(collection string, id interface{}, fields ...string) (*dal.Record, error)

func (*CachingBackend) SetIndexer

func (self *CachingBackend) SetIndexer(cs dal.ConnectionString) error

func (*CachingBackend) String

func (self *CachingBackend) String() string

func (*CachingBackend) Update

func (self *CachingBackend) Update(collection string, records *dal.RecordSet, target ...string) error

func (*CachingBackend) WithAggregator

func (self *CachingBackend) WithAggregator(collection *dal.Collection) Aggregator

func (*CachingBackend) WithSearch

func (self *CachingBackend) WithSearch(collection *dal.Collection, filters ...*filter.Filter) Indexer

type ConnectOptions

type ConnectOptions struct {
	Indexer            string   `json:"indexer"`
	AdditionalIndexers []string `json:"additional_indexers"`
	SkipInitialize     bool     `json:"skip_initialize"`
}

type DynamoBackend

type DynamoBackend struct {
	Backend
	Indexer
	// contains filtered or unexported fields
}

func (*DynamoBackend) CreateCollection

func (self *DynamoBackend) CreateCollection(definition *dal.Collection) error

func (*DynamoBackend) Delete

func (self *DynamoBackend) Delete(name string, ids ...interface{}) error

func (*DynamoBackend) DeleteCollection

func (self *DynamoBackend) DeleteCollection(name string) error

func (*DynamoBackend) DeleteQuery

func (self *DynamoBackend) DeleteQuery(collection *dal.Collection, flt *filter.Filter) error

func (*DynamoBackend) Exists

func (self *DynamoBackend) Exists(name string, id interface{}) bool

func (*DynamoBackend) Flush

func (self *DynamoBackend) Flush() error

func (*DynamoBackend) FlushIndex

func (self *DynamoBackend) FlushIndex() error

func (*DynamoBackend) GetBackend

func (self *DynamoBackend) GetBackend() Backend

func (*DynamoBackend) GetCollection

func (self *DynamoBackend) GetCollection(name string) (*dal.Collection, error)

func (*DynamoBackend) GetConnectionString

func (self *DynamoBackend) GetConnectionString() *dal.ConnectionString

func (*DynamoBackend) Index

func (self *DynamoBackend) Index(collection *dal.Collection, records *dal.RecordSet) error

func (*DynamoBackend) IndexConnectionString

func (self *DynamoBackend) IndexConnectionString() *dal.ConnectionString

func (*DynamoBackend) IndexExists

func (self *DynamoBackend) IndexExists(collection *dal.Collection, id interface{}) bool

func (*DynamoBackend) IndexInitialize

func (self *DynamoBackend) IndexInitialize(Backend) error

func (*DynamoBackend) IndexRemove

func (self *DynamoBackend) IndexRemove(collection *dal.Collection, ids []interface{}) error

func (*DynamoBackend) IndexRetrieve

func (self *DynamoBackend) IndexRetrieve(collection *dal.Collection, id interface{}) (*dal.Record, error)

func (*DynamoBackend) Initialize

func (self *DynamoBackend) Initialize() error

func (*DynamoBackend) Insert

func (self *DynamoBackend) Insert(name string, records *dal.RecordSet) error

func (*DynamoBackend) ListCollections

func (self *DynamoBackend) ListCollections() ([]string, error)

func (*DynamoBackend) ListValues

func (self *DynamoBackend) ListValues(collection *dal.Collection, fields []string, flt *filter.Filter) (map[string][]interface{}, error)

func (*DynamoBackend) Ping

func (self *DynamoBackend) Ping(timeout time.Duration) error

func (*DynamoBackend) Query

func (self *DynamoBackend) Query(collection *dal.Collection, f *filter.Filter, resultFns ...IndexResultFunc) (*dal.RecordSet, error)

func (*DynamoBackend) QueryFunc

func (self *DynamoBackend) QueryFunc(collection *dal.Collection, flt *filter.Filter, resultFn IndexResultFunc) error

func (*DynamoBackend) RegisterCollection

func (self *DynamoBackend) RegisterCollection(definition *dal.Collection)

func (*DynamoBackend) Retrieve

func (self *DynamoBackend) Retrieve(name string, id interface{}, fields ...string) (*dal.Record, error)

func (*DynamoBackend) SetIndexer

func (self *DynamoBackend) SetIndexer(indexConnString dal.ConnectionString) error

func (*DynamoBackend) String

func (self *DynamoBackend) String() string

func (*DynamoBackend) Update

func (self *DynamoBackend) Update(name string, records *dal.RecordSet, target ...string) error

func (*DynamoBackend) WithAggregator

func (self *DynamoBackend) WithAggregator(collection *dal.Collection) Aggregator

func (*DynamoBackend) WithSearch

func (self *DynamoBackend) WithSearch(collection *dal.Collection, filters ...*filter.Filter) Indexer

type ElasticsearchIndexer

type ElasticsearchIndexer struct {
	Indexer
	// contains filtered or unexported fields
}

func NewElasticsearchIndexer

func NewElasticsearchIndexer(connection dal.ConnectionString) *ElasticsearchIndexer

func (*ElasticsearchIndexer) AggregatorConnectionString

func (self *ElasticsearchIndexer) AggregatorConnectionString() *dal.ConnectionString

func (*ElasticsearchIndexer) AggregatorInitialize

func (self *ElasticsearchIndexer) AggregatorInitialize(parent Backend) error

func (*ElasticsearchIndexer) Average

func (self *ElasticsearchIndexer) Average(collection *dal.Collection, field string, f ...*filter.Filter) (float64, error)

func (*ElasticsearchIndexer) Count

func (self *ElasticsearchIndexer) Count(collection *dal.Collection, flt ...*filter.Filter) (uint64, error)

func (*ElasticsearchIndexer) DeleteQuery

func (self *ElasticsearchIndexer) DeleteQuery(collection *dal.Collection, f *filter.Filter) error

func (*ElasticsearchIndexer) FlushIndex

func (self *ElasticsearchIndexer) FlushIndex() error

func (*ElasticsearchIndexer) GetBackend

func (self *ElasticsearchIndexer) GetBackend() Backend

func (*ElasticsearchIndexer) GroupBy

func (self *ElasticsearchIndexer) GroupBy(collection *dal.Collection, groupBy []string, aggregates []filter.Aggregate, flt ...*filter.Filter) (*dal.RecordSet, error)

func (*ElasticsearchIndexer) Index

func (self *ElasticsearchIndexer) Index(collection *dal.Collection, records *dal.RecordSet) error

func (*ElasticsearchIndexer) IndexConnectionString

func (self *ElasticsearchIndexer) IndexConnectionString() *dal.ConnectionString

func (*ElasticsearchIndexer) IndexExists

func (self *ElasticsearchIndexer) IndexExists(collection *dal.Collection, id interface{}) bool

func (*ElasticsearchIndexer) IndexInitialize

func (self *ElasticsearchIndexer) IndexInitialize(parent Backend) error

func (*ElasticsearchIndexer) IndexRemove

func (self *ElasticsearchIndexer) IndexRemove(collection *dal.Collection, ids []interface{}) error

func (*ElasticsearchIndexer) IndexRetrieve

func (self *ElasticsearchIndexer) IndexRetrieve(collection *dal.Collection, id interface{}) (*dal.Record, error)

func (*ElasticsearchIndexer) ListValues

func (self *ElasticsearchIndexer) ListValues(collection *dal.Collection, fields []string, f *filter.Filter) (map[string][]interface{}, error)

func (*ElasticsearchIndexer) Maximum

func (self *ElasticsearchIndexer) Maximum(collection *dal.Collection, field string, f ...*filter.Filter) (float64, error)

func (*ElasticsearchIndexer) Minimum

func (self *ElasticsearchIndexer) Minimum(collection *dal.Collection, field string, f ...*filter.Filter) (float64, error)

func (*ElasticsearchIndexer) Query

func (self *ElasticsearchIndexer) Query(collection *dal.Collection, f *filter.Filter, resultFns ...IndexResultFunc) (*dal.RecordSet, error)

func (*ElasticsearchIndexer) QueryFunc

func (self *ElasticsearchIndexer) QueryFunc(collection *dal.Collection, f *filter.Filter, resultFn IndexResultFunc) error

func (*ElasticsearchIndexer) Sum

func (self *ElasticsearchIndexer) Sum(collection *dal.Collection, field string, f ...*filter.Filter) (float64, error)

type EmbeddedRecordBackend

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

func NewEmbeddedRecordBackend

func NewEmbeddedRecordBackend(parent Backend) *EmbeddedRecordBackend

func (*EmbeddedRecordBackend) CreateCollection

func (self *EmbeddedRecordBackend) CreateCollection(definition *dal.Collection) error

func (*EmbeddedRecordBackend) Delete

func (self *EmbeddedRecordBackend) Delete(collection string, ids ...interface{}) error

func (*EmbeddedRecordBackend) DeleteCollection

func (self *EmbeddedRecordBackend) DeleteCollection(collection string) error

func (*EmbeddedRecordBackend) Exists

func (self *EmbeddedRecordBackend) Exists(collection string, id interface{}) bool

passthrough the remaining functions to fulfill the Backend interface -------------------------------------------------------------------------------------------------

func (*EmbeddedRecordBackend) Flush

func (self *EmbeddedRecordBackend) Flush() error

func (*EmbeddedRecordBackend) GetCollection

func (self *EmbeddedRecordBackend) GetCollection(collection string) (*dal.Collection, error)

func (*EmbeddedRecordBackend) GetConnectionString

func (self *EmbeddedRecordBackend) GetConnectionString() *dal.ConnectionString

func (*EmbeddedRecordBackend) Inflate

func (self *EmbeddedRecordBackend) Inflate(collection *dal.Collection, record *dal.Record) (*dal.Record, error)

func (*EmbeddedRecordBackend) Initialize

func (self *EmbeddedRecordBackend) Initialize() error

func (*EmbeddedRecordBackend) Insert

func (self *EmbeddedRecordBackend) Insert(collection string, records *dal.RecordSet) error

func (*EmbeddedRecordBackend) ListCollections

func (self *EmbeddedRecordBackend) ListCollections() ([]string, error)

func (*EmbeddedRecordBackend) Ping

func (self *EmbeddedRecordBackend) Ping(d time.Duration) error

func (*EmbeddedRecordBackend) RegisterCollection

func (self *EmbeddedRecordBackend) RegisterCollection(c *dal.Collection)

func (*EmbeddedRecordBackend) Retrieve

func (self *EmbeddedRecordBackend) Retrieve(name string, id interface{}, fields ...string) (*dal.Record, error)

func (*EmbeddedRecordBackend) SetIndexer

func (self *EmbeddedRecordBackend) SetIndexer(cs dal.ConnectionString) error

func (*EmbeddedRecordBackend) String

func (self *EmbeddedRecordBackend) String() string

func (*EmbeddedRecordBackend) Update

func (self *EmbeddedRecordBackend) Update(collection string, records *dal.RecordSet, target ...string) error

func (*EmbeddedRecordBackend) WithAggregator

func (self *EmbeddedRecordBackend) WithAggregator(collection *dal.Collection) Aggregator

func (*EmbeddedRecordBackend) WithSearch

func (self *EmbeddedRecordBackend) WithSearch(collection *dal.Collection, filters ...*filter.Filter) Indexer

type FilesystemBackend

type FilesystemBackend struct {
	Backend
	Indexer
	// contains filtered or unexported fields
}

func (*FilesystemBackend) CreateCollection

func (self *FilesystemBackend) CreateCollection(definition *dal.Collection) error

func (*FilesystemBackend) Delete

func (self *FilesystemBackend) Delete(name string, ids ...interface{}) error

func (*FilesystemBackend) DeleteCollection

func (self *FilesystemBackend) DeleteCollection(name string) error

func (*FilesystemBackend) DeleteQuery

func (self *FilesystemBackend) DeleteQuery(collection *dal.Collection, f *filter.Filter) error

func (*FilesystemBackend) Exists

func (self *FilesystemBackend) Exists(name string, id interface{}) bool

func (*FilesystemBackend) Flush

func (self *FilesystemBackend) Flush() error

func (*FilesystemBackend) FlushIndex

func (self *FilesystemBackend) FlushIndex() error

func (*FilesystemBackend) GetBackend

func (self *FilesystemBackend) GetBackend() Backend

func (*FilesystemBackend) GetCollection

func (self *FilesystemBackend) GetCollection(name string) (*dal.Collection, error)

func (*FilesystemBackend) GetConnectionString

func (self *FilesystemBackend) GetConnectionString() *dal.ConnectionString

func (*FilesystemBackend) Index

func (self *FilesystemBackend) Index(collection *dal.Collection, records *dal.RecordSet) error

func (*FilesystemBackend) IndexConnectionString

func (self *FilesystemBackend) IndexConnectionString() *dal.ConnectionString

func (*FilesystemBackend) IndexExists

func (self *FilesystemBackend) IndexExists(collection *dal.Collection, id interface{}) bool

func (*FilesystemBackend) IndexInitialize

func (self *FilesystemBackend) IndexInitialize(_ Backend) error

func (*FilesystemBackend) IndexRemove

func (self *FilesystemBackend) IndexRemove(collection *dal.Collection, ids []interface{}) error

func (*FilesystemBackend) IndexRetrieve

func (self *FilesystemBackend) IndexRetrieve(collection *dal.Collection, id interface{}) (*dal.Record, error)

func (*FilesystemBackend) Initialize

func (self *FilesystemBackend) Initialize() error

func (*FilesystemBackend) Insert

func (self *FilesystemBackend) Insert(collectionName string, recordset *dal.RecordSet) error

func (*FilesystemBackend) ListCollections

func (self *FilesystemBackend) ListCollections() ([]string, error)

func (*FilesystemBackend) ListValues

func (self *FilesystemBackend) ListValues(collection *dal.Collection, fields []string, f *filter.Filter) (map[string][]interface{}, error)

func (*FilesystemBackend) Ping

func (self *FilesystemBackend) Ping(timeout time.Duration) error

func (*FilesystemBackend) Query

func (self *FilesystemBackend) Query(collection *dal.Collection, f *filter.Filter, resultFns ...IndexResultFunc) (*dal.RecordSet, error)

func (*FilesystemBackend) QueryFunc

func (self *FilesystemBackend) QueryFunc(collection *dal.Collection, filter *filter.Filter, resultFn IndexResultFunc) error

func (*FilesystemBackend) RegisterCollection

func (self *FilesystemBackend) RegisterCollection(collection *dal.Collection)

func (*FilesystemBackend) Retrieve

func (self *FilesystemBackend) Retrieve(name string, id interface{}, fields ...string) (*dal.Record, error)

func (*FilesystemBackend) SetIndexer

func (self *FilesystemBackend) SetIndexer(indexConnString dal.ConnectionString) error

func (*FilesystemBackend) String

func (self *FilesystemBackend) String() string

func (*FilesystemBackend) Update

func (self *FilesystemBackend) Update(name string, recordset *dal.RecordSet, target ...string) error

func (*FilesystemBackend) WithAggregator

func (self *FilesystemBackend) WithAggregator(collection *dal.Collection) Aggregator

func (*FilesystemBackend) WithSearch

func (self *FilesystemBackend) WithSearch(collection *dal.Collection, filters ...*filter.Filter) Indexer

type IndexOperation

type IndexOperation int
const (
	RetrieveOperation IndexOperation = iota
	PersistOperation
	DeleteOperation
	InspectionOperation
)

type IndexPage

type IndexPage struct {
	Page         int
	TotalPages   int
	Limit        int
	Offset       int
	TotalResults int64
}

type IndexResultFunc

type IndexResultFunc func(record *dal.Record, err error, page IndexPage) error // {}

type IndexSelectionStrategy

type IndexSelectionStrategy int
const (
	Sequential IndexSelectionStrategy = iota
	All
	First
	AllExceptFirst
	Random
)

func (IndexSelectionStrategy) IsCompoundable

func (self IndexSelectionStrategy) IsCompoundable() bool

type Indexer

type Indexer interface {
	IndexConnectionString() *dal.ConnectionString
	IndexInitialize(Backend) error
	IndexExists(collection *dal.Collection, id interface{}) bool
	IndexRetrieve(collection *dal.Collection, id interface{}) (*dal.Record, error)
	IndexRemove(collection *dal.Collection, ids []interface{}) error
	Index(collection *dal.Collection, records *dal.RecordSet) error
	QueryFunc(collection *dal.Collection, filter *filter.Filter, resultFn IndexResultFunc) error
	Query(collection *dal.Collection, filter *filter.Filter, resultFns ...IndexResultFunc) (*dal.RecordSet, error)
	ListValues(collection *dal.Collection, fields []string, filter *filter.Filter) (map[string][]interface{}, error)
	DeleteQuery(collection *dal.Collection, f *filter.Filter) error
	FlushIndex() error
	GetBackend() Backend
}

func MakeIndexer

func MakeIndexer(connection dal.ConnectionString) (Indexer, error)

type IndexerResult

type IndexerResult struct {
	Index   int
	Indexer Indexer
}

type IndexerResultFunc

type IndexerResultFunc func(indexer Indexer, current int, last int) error // {}

type MetaIndex

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

func NewMetaIndex

func NewMetaIndex(leftIndexer Indexer, leftCollection *dal.Collection, leftField string, rightIndexer Indexer, rightCollection *dal.Collection, rightField string) *MetaIndex

func (*MetaIndex) DeleteQuery

func (self *MetaIndex) DeleteQuery(collection *dal.Collection, f *filter.Filter) error

func (*MetaIndex) FlushIndex

func (self *MetaIndex) FlushIndex() error

func (*MetaIndex) GetBackend

func (self *MetaIndex) GetBackend() Backend

func (*MetaIndex) Index

func (self *MetaIndex) Index(collection *dal.Collection, records *dal.RecordSet) error

func (*MetaIndex) IndexConnectionString

func (self *MetaIndex) IndexConnectionString() *dal.ConnectionString

func (*MetaIndex) IndexExists

func (self *MetaIndex) IndexExists(collection *dal.Collection, id interface{}) bool

func (*MetaIndex) IndexInitialize

func (self *MetaIndex) IndexInitialize(_ Backend) error

func (*MetaIndex) IndexRemove

func (self *MetaIndex) IndexRemove(collection *dal.Collection, ids []interface{}) error

func (*MetaIndex) IndexRetrieve

func (self *MetaIndex) IndexRetrieve(collection *dal.Collection, id interface{}) (*dal.Record, error)

func (*MetaIndex) ListValues

func (self *MetaIndex) ListValues(collection *dal.Collection, fields []string, filter *filter.Filter) (map[string][]interface{}, error)

func (*MetaIndex) Query

func (self *MetaIndex) Query(collection *dal.Collection, f *filter.Filter, resultFns ...IndexResultFunc) (*dal.RecordSet, error)

func (*MetaIndex) QueryFunc

func (self *MetaIndex) QueryFunc(collection *dal.Collection, f *filter.Filter, resultFn IndexResultFunc) error

type Migratable

type Migratable interface {
	Migrate(diff []dal.SchemaDelta) error
}

type MongoBackend

type MongoBackend struct {
	Backend
	Indexer
	// contains filtered or unexported fields
}

func (*MongoBackend) AggregatorConnectionString

func (self *MongoBackend) AggregatorConnectionString() *dal.ConnectionString

func (*MongoBackend) AggregatorInitialize

func (self *MongoBackend) AggregatorInitialize(parent Backend) error

func (*MongoBackend) Average

func (self *MongoBackend) Average(collection *dal.Collection, field string, f ...*filter.Filter) (float64, error)

func (*MongoBackend) Count

func (self *MongoBackend) Count(collection *dal.Collection, flt ...*filter.Filter) (uint64, error)

func (*MongoBackend) CreateCollection

func (self *MongoBackend) CreateCollection(definition *dal.Collection) error

func (*MongoBackend) Delete

func (self *MongoBackend) Delete(name string, ids ...interface{}) error

func (*MongoBackend) DeleteCollection

func (self *MongoBackend) DeleteCollection(name string) error

func (*MongoBackend) DeleteQuery

func (self *MongoBackend) DeleteQuery(collection *dal.Collection, flt *filter.Filter) error

func (*MongoBackend) Exists

func (self *MongoBackend) Exists(name string, id interface{}) bool

func (*MongoBackend) Flush

func (self *MongoBackend) Flush() error

func (*MongoBackend) FlushIndex

func (self *MongoBackend) FlushIndex() error

func (*MongoBackend) GetBackend

func (self *MongoBackend) GetBackend() Backend

func (*MongoBackend) GetCollection

func (self *MongoBackend) GetCollection(name string) (*dal.Collection, error)

func (*MongoBackend) GetConnectionString

func (self *MongoBackend) GetConnectionString() *dal.ConnectionString

func (*MongoBackend) GroupBy

func (self *MongoBackend) GroupBy(collection *dal.Collection, groupBy []string, aggregates []filter.Aggregate, flt ...*filter.Filter) (*dal.RecordSet, error)

func (*MongoBackend) Index

func (self *MongoBackend) Index(collection *dal.Collection, records *dal.RecordSet) error

func (*MongoBackend) IndexConnectionString

func (self *MongoBackend) IndexConnectionString() *dal.ConnectionString

func (*MongoBackend) IndexExists

func (self *MongoBackend) IndexExists(collection *dal.Collection, id interface{}) bool

func (*MongoBackend) IndexInitialize

func (self *MongoBackend) IndexInitialize(Backend) error

func (*MongoBackend) IndexRemove

func (self *MongoBackend) IndexRemove(collection *dal.Collection, ids []interface{}) error

func (*MongoBackend) IndexRetrieve

func (self *MongoBackend) IndexRetrieve(collection *dal.Collection, id interface{}) (*dal.Record, error)

func (*MongoBackend) Initialize

func (self *MongoBackend) Initialize() error

func (*MongoBackend) Insert

func (self *MongoBackend) Insert(name string, records *dal.RecordSet) error

func (*MongoBackend) ListCollections

func (self *MongoBackend) ListCollections() ([]string, error)

func (*MongoBackend) ListValues

func (self *MongoBackend) ListValues(collection *dal.Collection, fields []string, flt *filter.Filter) (map[string][]interface{}, error)

func (*MongoBackend) Maximum

func (self *MongoBackend) Maximum(collection *dal.Collection, field string, f ...*filter.Filter) (float64, error)

func (*MongoBackend) Minimum

func (self *MongoBackend) Minimum(collection *dal.Collection, field string, f ...*filter.Filter) (float64, error)

func (*MongoBackend) Ping

func (self *MongoBackend) Ping(timeout time.Duration) error

func (*MongoBackend) Query

func (self *MongoBackend) Query(collection *dal.Collection, f *filter.Filter, resultFns ...IndexResultFunc) (*dal.RecordSet, error)

func (*MongoBackend) QueryFunc

func (self *MongoBackend) QueryFunc(collection *dal.Collection, flt *filter.Filter, resultFn IndexResultFunc) error

func (*MongoBackend) RegisterCollection

func (self *MongoBackend) RegisterCollection(collection *dal.Collection)

func (*MongoBackend) Retrieve

func (self *MongoBackend) Retrieve(name string, id interface{}, fields ...string) (*dal.Record, error)

func (*MongoBackend) SetIndexer

func (self *MongoBackend) SetIndexer(indexConnString dal.ConnectionString) error

func (*MongoBackend) String

func (self *MongoBackend) String() string

func (*MongoBackend) Sum

func (self *MongoBackend) Sum(collection *dal.Collection, field string, f ...*filter.Filter) (float64, error)

func (*MongoBackend) Update

func (self *MongoBackend) Update(name string, records *dal.RecordSet, target ...string) error

func (*MongoBackend) WithAggregator

func (self *MongoBackend) WithAggregator(collection *dal.Collection) Aggregator

func (*MongoBackend) WithSearch

func (self *MongoBackend) WithSearch(collection *dal.Collection, filters ...*filter.Filter) Indexer

type MultiIndex

type MultiIndex struct {
	RetrievalStrategy  IndexSelectionStrategy
	PersistStrategy    IndexSelectionStrategy
	DeleteStrategy     IndexSelectionStrategy
	InspectionStrategy IndexSelectionStrategy
	// contains filtered or unexported fields
}

func NewMultiIndex

func NewMultiIndex(connectionStrings ...string) *MultiIndex

func (*MultiIndex) AddIndexer

func (self *MultiIndex) AddIndexer(indexer Indexer) error

func (*MultiIndex) AddIndexerByConnectionString

func (self *MultiIndex) AddIndexerByConnectionString(cs string) error

func (*MultiIndex) DeleteQuery

func (self *MultiIndex) DeleteQuery(collection *dal.Collection, f *filter.Filter) error

func (*MultiIndex) EachSelectedIndex

func (self *MultiIndex) EachSelectedIndex(collection *dal.Collection, operation IndexOperation, resultFn IndexerResultFunc) error

func (*MultiIndex) FlushIndex

func (self *MultiIndex) FlushIndex() error

func (*MultiIndex) GetBackend

func (self *MultiIndex) GetBackend() Backend

func (*MultiIndex) Index

func (self *MultiIndex) Index(collection *dal.Collection, records *dal.RecordSet) error

func (*MultiIndex) IndexConnectionString

func (self *MultiIndex) IndexConnectionString() *dal.ConnectionString

func (*MultiIndex) IndexExists

func (self *MultiIndex) IndexExists(collection *dal.Collection, id interface{}) bool

func (*MultiIndex) IndexInitialize

func (self *MultiIndex) IndexInitialize(backend Backend) error

func (*MultiIndex) IndexRemove

func (self *MultiIndex) IndexRemove(collection *dal.Collection, ids []interface{}) error

func (*MultiIndex) IndexRetrieve

func (self *MultiIndex) IndexRetrieve(collection *dal.Collection, id interface{}) (*dal.Record, error)

func (*MultiIndex) ListValues

func (self *MultiIndex) ListValues(collection *dal.Collection, fields []string, filter *filter.Filter) (map[string][]interface{}, error)

func (*MultiIndex) Query

func (self *MultiIndex) Query(collection *dal.Collection, filter *filter.Filter, resultFns ...IndexResultFunc) (*dal.RecordSet, error)

func (*MultiIndex) QueryFunc

func (self *MultiIndex) QueryFunc(collection *dal.Collection, filter *filter.Filter, resultFn IndexResultFunc) error

func (*MultiIndex) SelectIndex

func (self *MultiIndex) SelectIndex(collection *dal.Collection, operation IndexOperation, lastIndexer int) ([]IndexerResult, error)

type NullIndexer

type NullIndexer struct {
}

func (*NullIndexer) DeleteQuery

func (self *NullIndexer) DeleteQuery(collection *dal.Collection, f filter.Filter) error

func (*NullIndexer) FlushIndex

func (self *NullIndexer) FlushIndex() error

func (*NullIndexer) GetBackend

func (self *NullIndexer) GetBackend() Backend

func (*NullIndexer) Index

func (self *NullIndexer) Index(collection *dal.Collection, records *dal.RecordSet) error

func (*NullIndexer) IndexConnectionString

func (self *NullIndexer) IndexConnectionString() *dal.ConnectionString

func (*NullIndexer) IndexExists

func (self *NullIndexer) IndexExists(collection *dal.Collection, id interface{}) bool

func (*NullIndexer) IndexInitialize

func (self *NullIndexer) IndexInitialize(Backend) error

func (*NullIndexer) IndexRemove

func (self *NullIndexer) IndexRemove(collection *dal.Collection, ids []interface{}) error

func (*NullIndexer) IndexRetrieve

func (self *NullIndexer) IndexRetrieve(collection *dal.Collection, id interface{}) (*dal.Record, error)

func (*NullIndexer) ListValues

func (self *NullIndexer) ListValues(collection *dal.Collection, fields []string, filter filter.Filter) (map[string][]interface{}, error)

func (*NullIndexer) Query

func (self *NullIndexer) Query(collection *dal.Collection, filter filter.Filter, resultFns ...IndexResultFunc) (*dal.RecordSet, error)

func (*NullIndexer) QueryFunc

func (self *NullIndexer) QueryFunc(collection *dal.Collection, filter filter.Filter, resultFn IndexResultFunc) error

type RedisBackend

type RedisBackend struct {
	Backend
	// contains filtered or unexported fields
}

func (*RedisBackend) CreateCollection

func (self *RedisBackend) CreateCollection(definition *dal.Collection) error

func (*RedisBackend) Delete

func (self *RedisBackend) Delete(name string, ids ...interface{}) error

func (*RedisBackend) DeleteCollection

func (self *RedisBackend) DeleteCollection(name string) error

func (*RedisBackend) DeleteQuery added in v3.0.7

func (self *RedisBackend) DeleteQuery(collection *dal.Collection, flt *filter.Filter) error

func (*RedisBackend) Exists

func (self *RedisBackend) Exists(name string, id interface{}) bool

func (*RedisBackend) Flush

func (self *RedisBackend) Flush() error

func (*RedisBackend) FlushIndex added in v3.0.7

func (self *RedisBackend) FlushIndex() error

func (*RedisBackend) GetBackend added in v3.0.7

func (self *RedisBackend) GetBackend() Backend

func (*RedisBackend) GetCollection

func (self *RedisBackend) GetCollection(name string) (*dal.Collection, error)

func (*RedisBackend) GetConnectionString

func (self *RedisBackend) GetConnectionString() *dal.ConnectionString

func (*RedisBackend) Index added in v3.0.7

func (self *RedisBackend) Index(collection *dal.Collection, records *dal.RecordSet) error

func (*RedisBackend) IndexConnectionString added in v3.0.7

func (self *RedisBackend) IndexConnectionString() *dal.ConnectionString

func (*RedisBackend) IndexExists added in v3.0.7

func (self *RedisBackend) IndexExists(collection *dal.Collection, id interface{}) bool

func (*RedisBackend) IndexInitialize added in v3.0.7

func (self *RedisBackend) IndexInitialize(Backend) error

func (*RedisBackend) IndexRemove added in v3.0.7

func (self *RedisBackend) IndexRemove(collection *dal.Collection, ids []interface{}) error

func (*RedisBackend) IndexRetrieve added in v3.0.7

func (self *RedisBackend) IndexRetrieve(collection *dal.Collection, id interface{}) (*dal.Record, error)

func (*RedisBackend) Initialize

func (self *RedisBackend) Initialize() error

func (*RedisBackend) Insert

func (self *RedisBackend) Insert(name string, recordset *dal.RecordSet) error

func (*RedisBackend) ListCollections

func (self *RedisBackend) ListCollections() ([]string, error)

func (*RedisBackend) ListValues added in v3.0.7

func (self *RedisBackend) ListValues(collection *dal.Collection, fields []string, flt *filter.Filter) (map[string][]interface{}, error)

func (*RedisBackend) Ping

func (self *RedisBackend) Ping(timeout time.Duration) error

func (*RedisBackend) Query added in v3.0.7

func (self *RedisBackend) Query(collection *dal.Collection, f *filter.Filter, resultFns ...IndexResultFunc) (*dal.RecordSet, error)

func (*RedisBackend) QueryFunc added in v3.0.7

func (self *RedisBackend) QueryFunc(collection *dal.Collection, flt *filter.Filter, resultFn IndexResultFunc) error

func (*RedisBackend) RegisterCollection

func (self *RedisBackend) RegisterCollection(collection *dal.Collection)

func (*RedisBackend) Retrieve

func (self *RedisBackend) Retrieve(name string, id interface{}, fields ...string) (*dal.Record, error)

func (*RedisBackend) SetIndexer

func (self *RedisBackend) SetIndexer(indexConnString dal.ConnectionString) error

func (*RedisBackend) String

func (self *RedisBackend) String() string

func (*RedisBackend) Update

func (self *RedisBackend) Update(name string, recordset *dal.RecordSet, target ...string) error

func (*RedisBackend) WithAggregator

func (self *RedisBackend) WithAggregator(collection *dal.Collection) Aggregator

func (*RedisBackend) WithSearch

func (self *RedisBackend) WithSearch(collection *dal.Collection, filters ...*filter.Filter) Indexer

type SerializationFormat

type SerializationFormat string

type SqlBackend

type SqlBackend struct {
	Backend
	Indexer
	Aggregator
	// contains filtered or unexported fields
}

func (*SqlBackend) AggregatorConnectionString

func (self *SqlBackend) AggregatorConnectionString() *dal.ConnectionString

func (*SqlBackend) AggregatorInitialize

func (self *SqlBackend) AggregatorInitialize(parent Backend) error

func (*SqlBackend) Average

func (self *SqlBackend) Average(collection *dal.Collection, field string, f ...*filter.Filter) (float64, error)

func (*SqlBackend) Count

func (self *SqlBackend) Count(collection *dal.Collection, f ...*filter.Filter) (uint64, error)

func (*SqlBackend) CreateCollection

func (self *SqlBackend) CreateCollection(definition *dal.Collection) error

func (*SqlBackend) Delete

func (self *SqlBackend) Delete(name string, ids ...interface{}) error

func (*SqlBackend) DeleteCollection

func (self *SqlBackend) DeleteCollection(collectionName string) error

func (*SqlBackend) DeleteQuery

func (self *SqlBackend) DeleteQuery(collection *dal.Collection, f *filter.Filter) error

DeleteQuery removes records using a filter

func (*SqlBackend) Exists

func (self *SqlBackend) Exists(name string, id interface{}) bool

func (*SqlBackend) Flush

func (self *SqlBackend) Flush() error

func (*SqlBackend) FlushIndex

func (self *SqlBackend) FlushIndex() error

func (*SqlBackend) GetBackend

func (self *SqlBackend) GetBackend() Backend

func (*SqlBackend) GetCollection

func (self *SqlBackend) GetCollection(name string) (*dal.Collection, error)

func (*SqlBackend) GetConnectionString

func (self *SqlBackend) GetConnectionString() *dal.ConnectionString

func (*SqlBackend) GroupBy

func (self *SqlBackend) GroupBy(collection *dal.Collection, groupBy []string, aggregates []filter.Aggregate, f ...*filter.Filter) (*dal.RecordSet, error)

func (*SqlBackend) Index

func (self *SqlBackend) Index(collection *dal.Collection, records *dal.RecordSet) error

Index is a no-op, this should be handled by SqlBackend's Insert() function

func (*SqlBackend) IndexConnectionString

func (self *SqlBackend) IndexConnectionString() *dal.ConnectionString

func (*SqlBackend) IndexExists

func (self *SqlBackend) IndexExists(collection *dal.Collection, id interface{}) bool

func (*SqlBackend) IndexInitialize

func (self *SqlBackend) IndexInitialize(parent Backend) error

func (*SqlBackend) IndexRemove

func (self *SqlBackend) IndexRemove(collection *dal.Collection, ids []interface{}) error

IndexRemove is a no-op, this should be handled by SqlBackend's Delete() function

func (*SqlBackend) IndexRetrieve

func (self *SqlBackend) IndexRetrieve(collection *dal.Collection, id interface{}) (*dal.Record, error)

func (*SqlBackend) Initialize

func (self *SqlBackend) Initialize() error

func (*SqlBackend) Insert

func (self *SqlBackend) Insert(name string, recordset *dal.RecordSet) error

func (*SqlBackend) ListCollections

func (self *SqlBackend) ListCollections() ([]string, error)

func (*SqlBackend) ListValues

func (self *SqlBackend) ListValues(collection *dal.Collection, fields []string, f *filter.Filter) (map[string][]interface{}, error)

func (*SqlBackend) Maximum

func (self *SqlBackend) Maximum(collection *dal.Collection, field string, f ...*filter.Filter) (float64, error)

func (*SqlBackend) Minimum

func (self *SqlBackend) Minimum(collection *dal.Collection, field string, f ...*filter.Filter) (float64, error)

func (*SqlBackend) Ping

func (self *SqlBackend) Ping(timeout time.Duration) error

func (*SqlBackend) Query

func (self *SqlBackend) Query(collection *dal.Collection, f *filter.Filter, resultFns ...IndexResultFunc) (*dal.RecordSet, error)

func (*SqlBackend) QueryFunc

func (self *SqlBackend) QueryFunc(collection *dal.Collection, f *filter.Filter, resultFn IndexResultFunc) error

func (*SqlBackend) RegisterCollection

func (self *SqlBackend) RegisterCollection(collection *dal.Collection)

func (*SqlBackend) Retrieve

func (self *SqlBackend) Retrieve(name string, id interface{}, fields ...string) (*dal.Record, error)

func (*SqlBackend) SetIndexer

func (self *SqlBackend) SetIndexer(indexConnString dal.ConnectionString) error

func (*SqlBackend) String

func (self *SqlBackend) String() string

func (*SqlBackend) Sum

func (self *SqlBackend) Sum(collection *dal.Collection, field string, f ...*filter.Filter) (float64, error)

func (*SqlBackend) Update

func (self *SqlBackend) Update(name string, recordset *dal.RecordSet, target ...string) error

func (*SqlBackend) WithAggregator

func (self *SqlBackend) WithAggregator(collection *dal.Collection) Aggregator

func (*SqlBackend) WithSearch

func (self *SqlBackend) WithSearch(collection *dal.Collection, filters ...*filter.Filter) Indexer

type WrappedIndexer

type WrappedIndexer struct {
	RecordFunc func(*dal.Collection, *dal.Record) (*dal.Record, error)
	// contains filtered or unexported fields
}

func NewWrappedIndexer

func NewWrappedIndexer(indexer Indexer, parent Backend) *WrappedIndexer

func (*WrappedIndexer) DeleteQuery

func (self *WrappedIndexer) DeleteQuery(collection *dal.Collection, f *filter.Filter) error

func (*WrappedIndexer) FlushIndex

func (self *WrappedIndexer) FlushIndex() error

func (*WrappedIndexer) GetBackend

func (self *WrappedIndexer) GetBackend() Backend

func (*WrappedIndexer) Index

func (self *WrappedIndexer) Index(collection *dal.Collection, records *dal.RecordSet) error

func (*WrappedIndexer) IndexConnectionString

func (self *WrappedIndexer) IndexConnectionString() *dal.ConnectionString

func (*WrappedIndexer) IndexExists

func (self *WrappedIndexer) IndexExists(collection *dal.Collection, id interface{}) bool

func (*WrappedIndexer) IndexInitialize

func (self *WrappedIndexer) IndexInitialize(b Backend) error

func (*WrappedIndexer) IndexRemove

func (self *WrappedIndexer) IndexRemove(collection *dal.Collection, ids []interface{}) error

func (*WrappedIndexer) IndexRetrieve

func (self *WrappedIndexer) IndexRetrieve(collection *dal.Collection, id interface{}) (*dal.Record, error)

func (*WrappedIndexer) ListValues

func (self *WrappedIndexer) ListValues(collection *dal.Collection, fields []string, filter *filter.Filter) (map[string][]interface{}, error)

func (*WrappedIndexer) Query

func (self *WrappedIndexer) Query(collection *dal.Collection, filter *filter.Filter, resultFns ...IndexResultFunc) (*dal.RecordSet, error)

func (*WrappedIndexer) QueryFunc

func (self *WrappedIndexer) QueryFunc(collection *dal.Collection, filter *filter.Filter, resultFn IndexResultFunc) error

Jump to

Keyboard shortcuts

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