busdb

package
v0.11.1 Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2023 License: AGPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const LogCollectionName = "logs"

Variables

View Source
var (
	CreateOperation = &Operation{Type: bus.DatabaseEntryCreated}
	ReadOperation   = &Operation{Type: bus.DatabaseEntryRead}
)

Functions

This section is empty.

Types

type BusDatabase

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

BusDatabase

  1. Save entry to log
  2. Send update ticket to bus
  3. Add document to index

func NewDatabase

func NewDatabase(ctx context.Context, internal driver.Database, b *bus.Bus) (*BusDatabase, error)

func (*BusDatabase) Collection

func (db *BusDatabase) Collection(ctx context.Context, name string) (col driver.Collection, err error)

func (*BusDatabase) LogBatchCreate

func (db *BusDatabase) LogBatchCreate(ctx context.Context, logentries []*model.LogEntry) error

func (*BusDatabase) LogCreate

func (db *BusDatabase) LogCreate(ctx context.Context, logType, reference, message string) (*model.LogEntry, error)

func (*BusDatabase) LogList

func (db *BusDatabase) LogList(ctx context.Context, reference string) ([]*model.LogEntry, error)

func (*BusDatabase) Query

func (db *BusDatabase) Query(ctx context.Context, query string, vars map[string]any, operation *Operation) (cur driver.Cursor, logs *model.LogEntry, err error)

func (*BusDatabase) Remove

func (db *BusDatabase) Remove(ctx context.Context) (err error)

type Collection

type Collection[T any] struct {
	// contains filtered or unexported fields
}

func NewCollection

func NewCollection[T any](internal driver.Collection, db *BusDatabase) *Collection[T]

func (*Collection[T]) CreateDocument

func (c *Collection[T]) CreateDocument(_, newctx context.Context, key string, document *T) (meta driver.DocumentMeta, err error)

func (*Collection[T]) CreateEdge

func (c *Collection[T]) CreateEdge(_, newctx context.Context, edge *driver.EdgeDocument) (meta driver.DocumentMeta, err error)

func (*Collection[T]) CreateEdges

func (c *Collection[T]) CreateEdges(ctx context.Context, edges []*driver.EdgeDocument) (meta driver.DocumentMetaSlice, err error)

func (*Collection[T]) DocumentExists

func (c *Collection[T]) DocumentExists(ctx context.Context, id string) (exists bool, err error)

func (*Collection[T]) ReadDocument

func (c *Collection[T]) ReadDocument(ctx context.Context, key string, result *T) (meta driver.DocumentMeta, err error)

func (*Collection[T]) RemoveDocument

func (c *Collection[T]) RemoveDocument(ctx context.Context, formatInt string) (meta driver.DocumentMeta, err error)

func (*Collection[T]) ReplaceDocument

func (c *Collection[T]) ReplaceDocument(ctx context.Context, key string, document *T) (meta driver.DocumentMeta, err error)

func (*Collection[T]) Truncate

func (c *Collection[T]) Truncate(ctx context.Context) (err error)

func (*Collection[T]) UpdateDocument

func (c *Collection[T]) UpdateDocument(ctx context.Context, key string, update any) (meta driver.DocumentMeta, err error)

type Keyed

type Keyed[T any] struct {
	Key string
	Doc *T
}

func (*Keyed[T]) MarshalJSON

func (p *Keyed[T]) MarshalJSON() ([]byte, error)

type Operation

type Operation struct {
	Type bus.DatabaseUpdateType
	Ids  []driver.DocumentID
}

Jump to

Keyboard shortcuts

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