port

package
v0.0.7 Latest Latest
Warning

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

Go to latest
Published: Jan 18, 2026 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Connector

type Connector interface {
	Library
	Connect() error
	Disconnect() error
}

type DbExpression

type DbExpression struct {
	Expr string // simple column name or complex expression
	Op   string // only used when expression is column name
	Args []any
}

type DbMap

type DbMap map[string]any

type IDatabase

type IDatabase interface {
	Connector

	// Common methods that both databases should implement
	Ping(ctx context.Context) error

	// Get the underlying connection for specific operations
	GetConnection() any
	GetDriver() string
	GetName() string

	Count(ctx context.Context, table string, filter []DbExpression) (int64, error)
	Find(ctx context.Context, results any, table string, column []string, filter []DbExpression, sort map[string]int, limit int64, skip int64) error
	FindOne(ctx context.Context, result any, table string, column []string, filter []DbExpression, sort map[string]int) error
	InsertOne(ctx context.Context, table string, data any) (any, error)
	Update(ctx context.Context, table string, filter []DbExpression, data any) (int64, error)
	UpdateOne(ctx context.Context, table string, filter []DbExpression, data any) (int64, error)
	Delete(ctx context.Context, table string, filter []DbExpression) (int64, error)
	DeleteOne(ctx context.Context, table string, filter []DbExpression) (int64, error)
}

type IKafka

type IKafka interface {
	Connector

	Publish(ctx context.Context, topic string, message any) error
	Consume(ctx context.Context, topic string) (<-chan any, error)
}

type IMemoryCache

type IMemoryCache interface {
	Connector

	GetClient() any
}

Generic for Memory Caching (ex: Redis, MemCached)

type IPubSub

type IPubSub interface {
	Connector

	Publish(ctx context.Context, message any, attributes map[string]string) (string, error)
	RegisterReceiver(receiver PubSubReceiver)
	StartReceiving(ctx context.Context)
}

type IPubSubMessage

type IPubSubMessage interface {
	GetID() string
	GetData() []byte
	GetPublishTime() time.Time
	GetAttributes() map[string]string
}

type IRedis

type IRedis interface {
	Connector

	GetClient() any
}

type KafkaConsumer

type KafkaConsumer interface {
	Consume(ctx context.Context, message []byte) (bool, error)
}

type Library

type Library interface {
	Install(args ...any) error
	Uninstall() error
}

type PubSubReceiver

type PubSubReceiver interface {
	Consume(ctx context.Context, messages []IPubSubMessage) (map[string]bool, error)
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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