graphify

package module
v0.0.16 Latest Latest
Warning

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

Go to latest
Published: Mar 21, 2024 License: Unlicense Imports: 29 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AdminFromContext added in v0.0.11

func AdminFromContext(ctx context.Context) (admin *adminv1.Admin, found bool)

AdminFromContext ...

func CollectionFor

func CollectionFor(t reflect.Type) string

CollectionFor ...

func ContextWithAdmin added in v0.0.11

func ContextWithAdmin(parent context.Context, admin *adminv1.Admin) context.Context

ContextWithAdmin ...

func ContextWithConnection added in v0.0.11

func ContextWithConnection(parent context.Context, conn IConnection) context.Context

ContextWithConnection ...

func ContextWithObserver added in v0.0.11

func ContextWithObserver(parent context.Context, observer IObserver[Topic]) context.Context

ContextWithObserver ...

func ContextWithStorage added in v0.0.11

func ContextWithStorage(parent context.Context, storage IFileStorage) context.Context

func Create

func Create(ctx context.Context, val interface{}) ([]string, error)

Create ...

func Delete

func Delete(ctx context.Context, item interface{}) error

Delete ...

func DevelopmentContext added in v0.0.12

func DevelopmentContext(parent context.Context) context.Context

func IsDevelopmentContext added in v0.0.12

func IsDevelopmentContext(ctx context.Context) bool

func List

func List(ctx context.Context, bindVars map[string]interface{}, out interface{}) (int, error)

List ...

func ListKeys

func ListKeys(ctx context.Context, keys []string, out interface{}) error

ListKeys ...

func NewConnection

func NewConnection(conf DatabaseConfig) *connection

NewConnection ...

func NewFilesystemStorage added in v0.0.6

func NewFilesystemStorage(basePath string, maxMemory int) *filesystemStorage

NewFilesystemStorage ...

func NewGraph

func NewGraph() *graph

func Read

func Read(ctx context.Context, key string, out interface{}) error

Read ...

func Relations added in v0.0.11

func Relations(ctx context.Context, id string, bindVars map[string]interface{}, direction Direction, out interface{}) (int, error)

Relations ...

func Update

func Update(ctx context.Context, key string, item interface{}) error

Update ...

Types

type ApplicationConfig added in v0.0.9

type ApplicationConfig struct {
	// Name ...
	Name string `json:"name"`
	// Domain ...
	Domain string `json:"domain"`
	Logo string `json:"logo"`
}

ApplicationConfig ...

type DatabaseConfig

type DatabaseConfig struct {
	// DBName ...
	DBName string
	// UserName ...
	UserName string
	// Password ...
	Password string
}

DatabaseConfig ...

type Direction added in v0.0.12

type Direction string
const (
	DirectionInbound  Direction = "INBOUND"
	DirectionOutbound Direction = "OUTBOUND"
	DirectionAny      Direction = "ANY"
)

type Event

type Event[T comparable] struct {
	// Topic ...
	Topic T
	// Payload ...
	Payload protoreflect.ProtoMessage
	// Timestamp ...
	Timestamp time.Time
}

Event ...

type IConnection

type IConnection interface {
	// GetDatabase ...
	GetDatabase(ctx context.Context) (driver.Database, error)
	// GetCollection ...
	GetCollection(ctx context.Context, elem reflect.Type) (driver.Collection, error)
}

IConnection ...

func ConnectionFromContext added in v0.0.11

func ConnectionFromContext(ctx context.Context) (conn IConnection, found bool)

ConnectionFromContext ...

type IFileStorage added in v0.0.6

type IFileStorage interface {
	// StoreFile ...
	StoreFile(name string, file []byte) (err error)

	// StoreByHash ...
	StoreByHash(file []byte) (hash string, err error)

	// ReadFile ...
	ReadFile(name string) (fileContent []byte, errr error)

	// MaxMemory ...
	MaxMemory() int
}

IFileStorage ...

func StorageFromContext added in v0.0.11

func StorageFromContext(ctx context.Context) (storage IFileStorage, found bool)

type IObserver

type IObserver[T comparable] interface {
	// Subscribe ...
	Subscribe(t T, p Processor[T]) SourceID
	// Unsubscribe ...
	Unsubscribe(s SourceID)
	// Emit ...
	Emit(e *Event[T]) error
}

IObserver ...

func ObserverFromContext added in v0.0.11

func ObserverFromContext(ctx context.Context) (observer IObserver[Topic], found bool)

ObserverFromContext ...

type Observer

type Observer[T comparable] struct {
	// contains filtered or unexported fields
}

Observer ...

func NewObserver

func NewObserver[T comparable]() *Observer[T]

NewObserver ...

func (*Observer[T]) Emit

func (o *Observer[T]) Emit(e *Event[T]) error

Emit ...

func (*Observer[T]) Subscribe

func (o *Observer[T]) Subscribe(t T, p Processor[T]) SourceID

Subscribe ...

func (*Observer[T]) Unsubscribe

func (o *Observer[T]) Unsubscribe(s SourceID)

Unsubscribe ...

type Processor

type Processor[T comparable] func(e *Event[T]) error

Processor ...

type SourceID

type SourceID int64

SourceID ...

type Topic

type Topic string
var (
	CreatedTopic Topic = "created"
	UpdatedTopic Topic = "updated"
	DeletedTopic Topic = "deleted"
)

func (Topic) For added in v0.0.2

func (t Topic) For(elem interface{}) Topic

Directories

Path Synopsis
models

Jump to

Keyboard shortcuts

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