badgerdb

package
v0.0.0-...-2c34a8a Latest Latest
Warning

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

Go to latest
Published: Feb 12, 2024 License: Apache-2.0 Imports: 14 Imported by: 0

README

Package cloudeng.io/cmd/idu/internal/database/badgerdb

CircleCI Go Report Card

import cloudeng.io/cmd/idu/internal/database/badgerdb

Variables

ReadOnly
ReadOnly = database.ReadOnly[Options]

WithTimeout
WithTimeout = database.WithTimeout[Options]

Functions

Func Open
func Open[T Options](location string, opts ...Option) (database.DB, error)

Open opens the specified database. If the database does not exist it will be created.

Types

Type Database
type Database struct {
	database.Options[Options]
	// contains filtered or unexported fields
}

Database represents a badger database.

Methods
func (db *Database) BadgerDB() *badger.DB
func (db *Database) Clear(_ context.Context, logs, errors bool) error
func (db *Database) Close(ctx context.Context) error

Close closes the database.

func (db *Database) DeleteErrors(ctx context.Context, prefix string) error
func (db *Database) DeletePrefix(ctx context.Context, prefix string) error
func (db *Database) Get(ctx context.Context, prefix string, buf *bytes.Buffer) error
func (db *Database) LastLog(ctx context.Context) (start, stop time.Time, detail []byte, err error)
func (db *Database) Log(ctx context.Context, start, stop time.Time, detail []byte) error
func (db *Database) LogError(ctx context.Context, key string, when time.Time, detail []byte) error
func (db *Database) Scan(ctx context.Context, path string, visitor func(ctx context.Context, key string, val []byte) bool) error
func (db *Database) Set(ctx context.Context, prefix string, val []byte, batch bool) error
func (db *Database) Stream(ctx context.Context, path string, visitor func(ctx context.Context, key string, val []byte)) error
func (db *Database) VisitErrors(ctx context.Context, key string,
	visitor func(ctx context.Context, key string, when time.Time, detail []byte) bool) error
func (db *Database) VisitLogs(ctx context.Context, start, stop time.Time, visitor func(ctx context.Context, begin, end time.Time, detail []byte) bool) error
Type Option
type Option func(o *database.Options[Options])

Option represents a specific option accepted by Open.

Functions
func WithBadgerOptions(opts badger.Options) Option

WithBadgerOptions specifies the options to be used when opening the database. Note, that it overrides all other badger specific options when used.

Type Options
type Options struct {
	badger.Options
}

Documentation

Index

Constants

This section is empty.

Variables

Functions

func Open

func Open[T Options](location string, opts ...Option) (database.DB, error)

Open opens the specified database. If the database does not exist it will be created.

Types

type Database

type Database struct {
	database.Options[Options]
	// contains filtered or unexported fields
}

Database represents a badger database.

func (*Database) BadgerDB

func (db *Database) BadgerDB() *badger.DB

func (*Database) Clear

func (db *Database) Clear(_ context.Context, logs, errors bool) error

func (*Database) Close

func (db *Database) Close(ctx context.Context) error

Close closes the database.

func (*Database) DeleteErrors

func (db *Database) DeleteErrors(ctx context.Context, prefix string) error

func (*Database) DeletePrefix

func (db *Database) DeletePrefix(ctx context.Context, prefix string) error

func (*Database) Get

func (db *Database) Get(ctx context.Context, prefix string, buf *bytes.Buffer) error

func (*Database) LastLog

func (db *Database) LastLog(ctx context.Context) (start, stop time.Time, detail []byte, err error)

func (*Database) Log

func (db *Database) Log(ctx context.Context, start, stop time.Time, detail []byte) error

func (*Database) LogError

func (db *Database) LogError(ctx context.Context, key string, when time.Time, detail []byte) error

func (*Database) Scan

func (db *Database) Scan(ctx context.Context, path string, visitor func(ctx context.Context, key string, val []byte) bool) error

func (*Database) Set

func (db *Database) Set(ctx context.Context, prefix string, val []byte, batch bool) error

func (*Database) Stream

func (db *Database) Stream(ctx context.Context, path string, visitor func(ctx context.Context, key string, val []byte)) error

func (*Database) VisitErrors

func (db *Database) VisitErrors(ctx context.Context, key string,
	visitor func(ctx context.Context, key string, when time.Time, detail []byte) bool) error

func (*Database) VisitLogs

func (db *Database) VisitLogs(ctx context.Context, start, stop time.Time, visitor func(ctx context.Context, begin, end time.Time, detail []byte) bool) error

type Option

type Option func(o *database.Options[Options])

Option represents a specific option accepted by Open.

func WithBadgerOptions

func WithBadgerOptions(opts badger.Options) Option

WithBadgerOptions specifies the options to be used when opening the database. Note, that it overrides all other badger specific options when used.

type Options

type Options struct {
	badger.Options
}

Jump to

Keyboard shortcuts

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