database

package
v0.2.4 Latest Latest
Warning

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

Go to latest
Published: Dec 28, 2022 License: GPL-3.0 Imports: 27 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 {
	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) GetArticleByID

func (db *Database) GetArticleByID(id string) (models.Article, error)

func (*Database) GetOwnID added in v0.1.0

func (db *Database) GetOwnID() string

func (*Database) GetOwnPubKey added in v0.1.0

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

func (*Database) ListArticles

func (db *Database) ListArticles() ([]*models.Article, []*models.Article, error)

func (*Database) SubmitArticle

func (db *Database) SubmitArticle(article *models.Article) error

Jump to

Keyboard shortcuts

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