edendb

package
v0.0.0-...-d6864b1 Latest Latest
Warning

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

Go to latest
Published: Jul 13, 2022 License: GPL-3.0 Imports: 1 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Database

type Database struct {
	Type DatabaseTypeID
}

func (*Database) AddIfNotExists

func (db *Database) AddIfNotExists(collectionName string, value interface{}) error

func (*Database) AddRecord

func (db *Database) AddRecord(collectionName string, value interface{}) error

func (*Database) DumpCollection

func (db *Database) DumpCollection(collectionName string, output []interface{}) error

func (*Database) DumpCollectionToWriter

func (db *Database) DumpCollectionToWriter(collectionName string, writer io.Writer) error

func (*Database) DumpDatabase

func (db *Database) DumpDatabase(output []interface{}) error

func (*Database) DumpToWriter

func (db *Database) DumpToWriter(writer io.Writer) error

func (*Database) FindAll

func (db *Database) FindAll(collectionName string, output []interface{}) error

func (*Database) FindAllByField

func (db *Database) FindAllByField(collectionName string, fieldName string, searchValue string, output []interface{}) error

func (*Database) GetTypeID

func (db *Database) GetTypeID() DatabaseTypeID

func (*Database) GetTypeName

func (db *Database) GetTypeName() string

func (*Database) Init

func (db *Database) Init() error

func (*Database) One

func (db *Database) One(collectionName string, field string, value interface{}, output interface{}) error

func (*Database) RemoveCollection

func (db *Database) RemoveCollection(collectionName string) error

func (*Database) RemoveRecord

func (db *Database) RemoveRecord(collectionName string, value interface{}) error

func (*Database) UpdateRecord

func (db *Database) UpdateRecord(collectionName string, value interface{}) error

type DatabaseType

type DatabaseType interface {
	GetTypeID() DatabaseTypeID
	GetTypeName() string
	Init() error

	AddRecord(string, interface{}) error                        // Add record to collection, return error if failed
	UpdateRecord(string, interface{}) error                     // Update record in collection if it exists, otherwise add it
	UpdateField(string, string, interface{}, interface{}) error // Update field in record if it exists, otherwise add it
	AddIfNotExists(string, interface{}) error                   // Add record to collection if it doesn't exist

	RemoveRecord(string, interface{}) error // Remove a specific record from the given collection
	RemoveCollection(string) error          // Remove the given collection and all its records

	// One single search result
	// Collection, Field, Value, Output
	One(string, string, interface{}, interface{}) error

	// FindAll records in collection that match the interface.
	FindAll(string, []interface{}) error

	// FindAllByField finds all interfaces by - collection, field, search value
	FindAllByField(string, string, string, []interface{}) error

	// DumpDatabase dumps the entire database as []interface{}
	DumpDatabase([]interface{}) error

	// DumpCollection dumps the entire collection as []interface{}
	DumpCollection(string, []interface{}) error

	// DumpToWriter dumps the entire database to the writer
	DumpToWriter(io.Writer) error

	// DumpCollectionToWriter dumps the entire collection to the writer
	DumpCollectionToWriter(string, io.Writer) error
}

type DatabaseTypeID

type DatabaseTypeID int
const (
	DatabaseTypeID_Unknown DatabaseTypeID = iota
	DatabaseTypeID_BoltDB
	DatabaseTypeID_MongoDB
)

func (*DatabaseTypeID) String

func (dt *DatabaseTypeID) String() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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