database

package
v0.0.0-...-12f1028 Latest Latest
Warning

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

Go to latest
Published: Oct 19, 2022 License: Apache-2.0 Imports: 26 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func StructToMap

func StructToMap(v interface{}) (map[string]interface{}, error)

Types

type Database

type Database struct {
	ConnectionString string
	URI              string
	CachePath        string
	Cache            *cache.Cache

	Logger *zap.Logger

	IPFSNode    *core.IpfsNode
	IPFSCoreAPI icore.CoreAPI

	OrbitDB orbitdb.OrbitDB
	Store   orbitdb.DocumentStore
	Events  event.Subscription
	// contains filtered or unexported fields
}

func NewDatabase

func NewDatabase(
	ctx context.Context,
	dbConnectionString string,
	dbCache string,
	cch *cache.Cache,
	logger *zap.Logger,
) (*Database, error)

func (*Database) Connect

func (db *Database) Connect(onReady func(address string)) error

func (*Database) Disconnect

func (db *Database) Disconnect()

func (*Database) GetDataByID

func (db *Database) GetDataByID(_id string) (models.Data, error)

func (*Database) GetOwnID

func (db *Database) GetOwnID() string

func (*Database) GetOwnPubKey

func (db *Database) GetOwnPubKey() crypto.PubKey

func (*Database) ListData

func (db *Database) ListData() ([]*models.Data, error)

func (*Database) SubmitData

func (db *Database) SubmitData(data *models.Data) error

Jump to

Keyboard shortcuts

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