embed

package
v0.9.8 Latest Latest
Warning

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

Go to latest
Published: Jan 16, 2026 License: MIT Imports: 6 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Count

func Count(dbname, collname string, spec map[string]any) int

Count records in BadgerDB

func Distinct

func Distinct(dbname, collname, field string) ([]any, error)

Distinct gets number records from document-oriented db

func Get

func Get(dbname, collname string, spec map[string]any, idx, limit int) []map[string]any

Get records from BadgerDB

func GetProjection added in v0.8.7

func GetProjection(dbname, collname string, spec map[string]any, projection map[string]int, idx, limit int) []map[string]any

GetProjection records from BadgerDB

func GetSorted

func GetSorted(dbname, collname string, spec map[string]any, skeys []string, sortOrder, idx, limit int) []map[string]any

GetSorted fetches records from document-oriented db sorted by given key with specific order

func InitDB

func InitDB(dbDir string) error

InitDB initializes the Badger database

func Insert added in v0.5.3

func Insert(dbname, collname string, records []map[string]any)

Insert records into BadgerDB

func InsertRecord

func InsertRecord(dbname, collname string, rec map[string]any) error

InsertRecord insert record with given spec to document-oriented db

func Remove

func Remove(dbname, collname string, spec map[string]any) error

Remove records from BadgerDB

func Update

func Update(dbname, collname string, spec, newdata map[string]any) error

Update records in BadgerDB

func Upsert

func Upsert(dbname, collname, attr string, records []map[string]any) error

Upsert records into BadgerDB

Types

type EmbedDB added in v0.5.9

type EmbedDB struct {
}

EmbedDB represent embedded database

func (*EmbedDB) Count added in v0.5.9

func (d *EmbedDB) Count(dbname, collname string, spec map[string]any) int

Count returns total number of records within database/collection and given spec

func (*EmbedDB) Distinct added in v0.5.9

func (d *EmbedDB) Distinct(dbname, collname, field string) ([]any, error)

Distinct returns distinct collection of records

func (*EmbedDB) Get added in v0.5.9

func (d *EmbedDB) Get(dbname, collname string, spec map[string]any, idx, limit int) []map[string]any

Get fetches data from underlying database/collection

func (*EmbedDB) GetProjection added in v0.8.7

func (d *EmbedDB) GetProjection(dbname, collname string, spec map[string]any, projection map[string]int, idx, limit int) []map[string]any

GetProjection fetches data from underlying database/collection

func (*EmbedDB) GetSorted added in v0.5.9

func (d *EmbedDB) GetSorted(dbname, collname string, spec map[string]any, skeys []string, sortOrder, idx, limit int) []map[string]any

GetSorted returns sorted records from given database/collection using provided spec, sorted keys, order and limits

func (*EmbedDB) InitDB added in v0.5.9

func (d *EmbedDB) InitDB(uri string)

InitDB initialize embedded database

func (*EmbedDB) Insert added in v0.5.9

func (d *EmbedDB) Insert(dbname, collname string, records []map[string]any)

Insert inserts records into provided database/collection

func (*EmbedDB) InsertRecord added in v0.5.9

func (d *EmbedDB) InsertRecord(dbname, collname string, rec map[string]any) error

InsertRecord inserts single record into given database/collection

func (*EmbedDB) Remove added in v0.5.9

func (d *EmbedDB) Remove(dbname, collname string, spec map[string]any) error

Remove deletes records in given database/collection using given spec

func (*EmbedDB) Update added in v0.5.9

func (d *EmbedDB) Update(dbname, collname string, spec, newdata map[string]any) error

Update updates data into given database/collection

func (*EmbedDB) Upsert added in v0.5.9

func (d *EmbedDB) Upsert(dbname, collname, attr string, records []map[string]any) error

Upsert inserts records into provided database/collection and attribute

Jump to

Keyboard shortcuts

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