Documentation ¶
Overview ¶
Package splunkbuntdb provides instrumentation for the github.com/tidwall/buntdb package.
Example ¶
package main import ( "fmt" "github.com/unionai/splunk-otel-go/instrumentation/github.com/tidwall/buntdb/splunkbuntdb" ) func main() { // Open the data.db file. It will be created if it doesn't exist. db, err := splunkbuntdb.Open(":memory:") if err != nil { panic(err) } defer db.Close() err = db.Update(func(tx *splunkbuntdb.Tx) error { _, _, errIn := tx.Set("mykey", "myvalue", nil) return errIn }) if err != nil { panic(err) } err = db.View(func(tx *splunkbuntdb.Tx) error { errIn := tx.Ascend("", func(key, value string) bool { fmt.Printf("key: %s, value: %s\n", key, value) return true }) return errIn }) if err != nil { panic(err) } }
Output:
Index ¶
- func Version() string
- type DB
- type Option
- type Tx
- func (tx *Tx) Ascend(index string, iterator func(key, value string) bool) error
- func (tx *Tx) AscendEqual(index, pivot string, iterator func(key, value string) bool) error
- func (tx *Tx) AscendGreaterOrEqual(index, pivot string, iterator func(key, value string) bool) error
- func (tx *Tx) AscendKeys(pattern string, iterator func(key, value string) bool) error
- func (tx *Tx) AscendLessThan(index, pivot string, iterator func(key, value string) bool) error
- func (tx *Tx) AscendRange(index, greaterOrEqual, lessThan string, iterator func(key, value string) bool) error
- func (tx *Tx) Commit() error
- func (tx *Tx) CreateIndex(name, pattern string, less ...func(a, b string) bool) error
- func (tx *Tx) CreateIndexOptions(name, pattern string, opts *buntdb.IndexOptions, ...) error
- func (tx *Tx) CreateSpatialIndex(name, pattern string, rect func(item string) (min, max []float64)) error
- func (tx *Tx) CreateSpatialIndexOptions(name, pattern string, opts *buntdb.IndexOptions, ...) error
- func (tx *Tx) Delete(key string) (val string, err error)
- func (tx *Tx) DeleteAll() error
- func (tx *Tx) Descend(index string, iterator func(key, value string) bool) error
- func (tx *Tx) DescendEqual(index, pivot string, iterator func(key, value string) bool) error
- func (tx *Tx) DescendGreaterThan(index, pivot string, iterator func(key, value string) bool) error
- func (tx *Tx) DescendKeys(pattern string, iterator func(key, value string) bool) error
- func (tx *Tx) DescendLessOrEqual(index, pivot string, iterator func(key, value string) bool) error
- func (tx *Tx) DescendRange(index, lessOrEqual, greaterThan string, iterator func(key, value string) bool) error
- func (tx *Tx) DropIndex(name string) error
- func (tx *Tx) Get(key string, ignoreExpired ...bool) (val string, err error)
- func (tx *Tx) Indexes() (indexes []string, err error)
- func (tx *Tx) Intersects(index, bounds string, iterator func(key, value string) bool) error
- func (tx *Tx) Len() (n int, err error)
- func (tx *Tx) Nearby(index, bounds string, iterator func(key, value string, dist float64) bool) error
- func (tx *Tx) Rollback() error
- func (tx *Tx) Set(key, value string, opts *buntdb.SetOptions) (previousValue string, replaced bool, err error)
- func (tx *Tx) TTL(key string) (duration time.Duration, err error)
- func (tx *Tx) WithContext(ctx context.Context) *Tx
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type DB ¶
A DB wraps a buntdb.DB, automatically tracing any transactions.
type Option ¶
type Option interface {
// contains filtered or unexported methods
}
Option applies options to a configuration.
func WithAttributes ¶
WithAttributes returns an Option that appends attr to the attributes set for every span created with this instrumentation library.
func WithContext ¶
WithContext returns an Option that sets the Context used with this instrumentation library by default. This is used to pass context of any existing trace to the instrumentation.
func WithTracerProvider ¶
func WithTracerProvider(tp trace.TracerProvider) Option
WithTracerProvider returns an Option that sets the TracerProvider used with this instrumentation library.
type Tx ¶
A Tx wraps a buntdb.Tx, automatically tracing any queries.
func (*Tx) AscendEqual ¶
AscendEqual calls the underlying Tx.AscendEqual and traces the query.
func (*Tx) AscendGreaterOrEqual ¶
func (tx *Tx) AscendGreaterOrEqual(index, pivot string, iterator func(key, value string) bool) error
AscendGreaterOrEqual calls the underlying Tx.AscendGreaterOrEqual and traces the query.
func (*Tx) AscendKeys ¶
AscendKeys calls the underlying Tx.AscendKeys and traces the query.
func (*Tx) AscendLessThan ¶
AscendLessThan calls the underlying Tx.AscendLessThan and traces the query.
func (*Tx) AscendRange ¶
func (tx *Tx) AscendRange(index, greaterOrEqual, lessThan string, iterator func(key, value string) bool) error
AscendRange calls the underlying Tx.AscendRange and traces the query.
func (*Tx) CreateIndex ¶
CreateIndex calls the underlying Tx.CreateIndex and traces the query.
func (*Tx) CreateIndexOptions ¶
func (tx *Tx) CreateIndexOptions(name, pattern string, opts *buntdb.IndexOptions, less ...func(a, b string) bool) error
CreateIndexOptions calls the underlying Tx.CreateIndexOptions and traces the query.
func (*Tx) CreateSpatialIndex ¶
func (tx *Tx) CreateSpatialIndex(name, pattern string, rect func(item string) (min, max []float64)) error
CreateSpatialIndex calls the underlying Tx.CreateSpatialIndex and traces the query.
func (*Tx) CreateSpatialIndexOptions ¶
func (tx *Tx) CreateSpatialIndexOptions(name, pattern string, opts *buntdb.IndexOptions, rect func(item string) (min, max []float64)) error
CreateSpatialIndexOptions calls the underlying Tx.CreateSpatialIndexOptions and traces the query.
func (*Tx) DescendEqual ¶
DescendEqual calls the underlying Tx.DescendEqual and traces the query.
func (*Tx) DescendGreaterThan ¶
DescendGreaterThan calls the underlying Tx.DescendGreaterThan and traces the query.
func (*Tx) DescendKeys ¶
DescendKeys calls the underlying Tx.DescendKeys and traces the query.
func (*Tx) DescendLessOrEqual ¶
DescendLessOrEqual calls the underlying Tx.DescendLessOrEqual and traces the query.
func (*Tx) DescendRange ¶
func (tx *Tx) DescendRange(index, lessOrEqual, greaterThan string, iterator func(key, value string) bool) error
DescendRange calls the underlying Tx.DescendRange and traces the query.
func (*Tx) Intersects ¶
Intersects calls the underlying Tx.Intersects and traces the query.
func (*Tx) Nearby ¶
func (tx *Tx) Nearby(index, bounds string, iterator func(key, value string, dist float64) bool) error
Nearby calls the underlying Tx.Nearby and traces the query.
func (*Tx) Set ¶
func (tx *Tx) Set(key, value string, opts *buntdb.SetOptions) (previousValue string, replaced bool, err error)
Set calls the underlying Tx.Set and traces the query.