Documentation
¶
Overview ¶
Package dao provides abstraction of persistence layer used by pydio services.
Index ¶
- func RegisterDAODriver(name string, daoF DaoProviderFunc, connF ConnProviderFunc)
- func RegisterIndexerDriver(name string, daoF IndexerWrapperFunc)
- type Conn
- type ConnDriver
- type ConnProviderFunc
- type DAO
- type DaoProviderFunc
- type DriverProviderFunc
- type FacetParser
- type IndexCodex
- type IndexDAO
- type IndexIDProvider
- type IndexerWrapperFunc
- type MigratorFunc
- type QueryOptionsProvider
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RegisterDAODriver ¶
func RegisterDAODriver(name string, daoF DaoProviderFunc, connF ConnProviderFunc)
RegisterDAODriver registers factories for DAOs and Connections
func RegisterIndexerDriver ¶
func RegisterIndexerDriver(name string, daoF IndexerWrapperFunc)
RegisterIndexerDriver registers factories for Indexers
Types ¶
type ConnDriver ¶
type ConnProviderFunc ¶
type ConnProviderFunc func(driver, dsn string) ConnDriver
type DAO ¶
type DAO interface {
Init(configx.Values) error
GetConn() Conn
SetConn(Conn)
CloseConn() error
Driver() string
// Prefix is used to prevent collision between table names
// in case this DAO accesses a shared DB.
Prefix() string
// LocalAccess returns true if DAO relies on an on-file DB
LocalAccess() bool
// Stats may return info about the underlying driver/conn
Stats() map[string]interface{}
}
DAO interface definition
func AbstractDAO ¶
AbstractDAO returns a reference to a newly created struct that contains the necessary information to access a database. Prefix parameter is used to specify a prefix to avoid collision between table names in case this DAO accesses a shared DB: it thus will be an empty string in most of the cases.
type DaoProviderFunc ¶
type DriverProviderFunc ¶
type FacetParser ¶
type FacetParser interface {
UnmarshalFacet(data interface{}, facets chan interface{})
FlushCustomFacets() []interface{}
}
FacetParser adds additional capacities to IndexCodex for understanding search results Facets
type IndexCodex ¶
type IndexCodex interface {
// Marshal prepares an document for storing in index
Marshal(input interface{}) (interface{}, error)
// Unmarshal decodes a document found in index
Unmarshal(indexed interface{}) (interface{}, error)
// BuildQuery prepares a query to be executed. It returns a request object and optionnaly an aggregationRequest object
BuildQuery(query interface{}, offset, limit int32) (interface{}, interface{}, error)
// GetModel reads initialization schema to be loaded
GetModel(sc configx.Values) (interface{}, bool)
}
IndexCodex is the coder/decoder used by an Indexer.
type IndexDAO ¶
type IndexDAO interface {
DAO
// SetCodex sets the IndexCodex to be used for marshalling/unmarshalling data. Can be locally overriden during FindMany requests.
SetCodex(c IndexCodex)
// InsertOne stores one document. Write operations may be batched underneath.
InsertOne(ctx context.Context, data interface{}) error
// DeleteOne deletes one document. It can only be used if documents are providing IDs.
DeleteOne(ctx context.Context, data interface{}) error
// Flush triggers internal buffers to be written to storage
Flush(ctx context.Context) error
// DeleteMany deletes documents by a search query.
DeleteMany(ctx context.Context, query interface{}) (int32, error)
// FindMany sends a search query to indexer. A custom IndexCodex can be used to accumulate some information during results parsing.
FindMany(ctx context.Context, query interface{}, offset, limit int32, customCodec IndexCodex) (chan interface{}, error)
// Resync should clear the index and rewrite it from scratch. Used by bolt implementations for defragmentation.
Resync(ctx context.Context, logger func(string)) error
// Truncate should free some disk space. Used by bleve implementation in conjunction with rotationSize parameter.
Truncate(ctx context.Context, max int64, logger func(string)) error
// Close closes the index connection
Close() error
}
IndexDAO is a rich DAO with ready-to-use inserts + search capacities. It must be initialised with a proper DAO and a proper IndexCodex.
type IndexIDProvider ¶
type IndexIDProvider interface {
IndexID() string
}
IndexIDProvider can be implemented by marshaled data to be indexed for providing an index ID.
type IndexerWrapperFunc ¶
type QueryOptionsProvider ¶
type QueryOptionsProvider interface {
BuildQueryOptions(query interface{}, offset, limit int32) (interface{}, error)
}
QueryOptionsProvider adds additional capacities to IndexCodex for building search Query
Directories
¶
| Path | Synopsis |
|---|---|
|
Package bleve provides tools for using Bolt as a standard persistence layer for services.
|
Package bleve provides tools for using Bolt as a standard persistence layer for services. |
|
Package BoltDB provides tools for using Bolt as a standard persistence layer for services
|
Package BoltDB provides tools for using Bolt as a standard persistence layer for services |