database

package
v0.12.6 Latest Latest
Warning

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

Go to latest
Published: May 1, 2022 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Database

type Database struct {
	// contains filtered or unexported fields
}

Database definition

func Open

func Open(path string, opts DatabaseOptions) (*Database, error)

Open a database connection

func (*Database) Close

func (d *Database) Close() error

Close database connection

func (*Database) Delete

func (d *Database) Delete(key string) error

Delete item by key from database

func (*Database) DeleteAll

func (d *Database) DeleteAll() error

DeleteAll deletes everything from the database

func (*Database) DeleteByPrefix

func (d *Database) DeleteByPrefix(keyPrefix string) error

DeleteByPrefix deletes all keys matching the prefix from database

func (*Database) Read

func (d *Database) Read(key string) ([]byte, error)

Read item from database

func (*Database) Write

func (d *Database) Write(key string, value []byte, ttl time.Duration) error

Write item to database (with TTL)

type DatabaseOptions

type DatabaseOptions struct {
	Logger badger.Logger
}

DatabaseOptions allow providing configuration

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
JackTT - Gopher 🇻🇳