Documentation ¶
Index ¶
- type DB
- type DBCollection
- func (db *DBCollection) Collection() *driver.Collection
- func (db *DBCollection) DeleteDocument(key string) (*driver.DocumentMeta, error)
- func (db *DBCollection) ExecQuery(query string, bindVars map[string]interface{}) error
- func (db *DBCollection) GetByKey(key string, result interface{}) (*driver.DocumentMeta, error)
- func (db *DBCollection) InsertDocument(v interface{}) (*driver.DocumentMeta, error)
- type DBInitializer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DB ¶
type DB struct { Database driver.Database Collections map[string]*DBCollection // contains filtered or unexported fields }
func (*DB) FromCollection ¶
func (db *DB) FromCollection(collectionName string) *DBCollection
FromCollection returns the DBCollection associated with the given collection name.
Parameters: - collectionName: the name of the collection.
Returns: - *DBCollection: the DBCollection associated with the given collection name.
type DBCollection ¶
type DBCollection struct {
// contains filtered or unexported fields
}
func (*DBCollection) Collection ¶
func (db *DBCollection) Collection() *driver.Collection
func (*DBCollection) DeleteDocument ¶
func (db *DBCollection) DeleteDocument(key string) (*driver.DocumentMeta, error)
DeleteDocument deletes a document from the DBCollection.
Parameters: - key: the key of the document to be deleted.
Returns: - *driver.DocumentMeta: the metadata of the deleted document. - error: an error if the deletion fails.
func (*DBCollection) ExecQuery ¶
func (db *DBCollection) ExecQuery(query string, bindVars map[string]interface{}) error
ExecQuery is a function that executes a query on a database collection.
It takes a query string and a map of bind variables as parameters. The query string is the query to be executed on the database. The bindVars map contains the bind variables to be used in the query. It returns an error if the query execution fails.
func (*DBCollection) GetByKey ¶
func (db *DBCollection) GetByKey(key string, result interface{}) (*driver.DocumentMeta, error)
GetByKey retrieves a document from the database by its key.
Parameters: - key: the key of the document to retrieve. - result: a pointer to a variable to store the retrieved document.
Returns: - *driver.DocumentMeta: metadata of the retrieved document. - error: any error that occurred during the retrieval process.
func (*DBCollection) InsertDocument ¶
func (db *DBCollection) InsertDocument(v interface{}) (*driver.DocumentMeta, error)
InsertDocument inserts a document into the DBCollection.
It takes a single parameter, v, which is the document to be inserted. The function returns a pointer to a DocumentMeta and an error.
type DBInitializer ¶
type DBInitializer struct {
// contains filtered or unexported fields
}
func NewDBInitializer ¶
func NewDBInitializer(ctx context.Context, client driver.Client) *DBInitializer