Skip to content

Module github.com/bide-ai/bide/govern/redislog ​

Go module github.com/bide-ai/bide/govern/redislog; all modules.

govern/redislog ​

github.com/bide-ai/bide/govern/redislog · pkg.go.dev · Stability: experimental

Package redislog is a durable, networked govern.EventLog backed by Redis Streams, the "no SQL database required" adapter.

type Log ​

go
type Log struct {
	// contains filtered or unexported fields
}

Log is a Redis-Streams-backed event log; each entity is one stream (prefix+entity).

Constructors and functions

  • func NewWithClient(rc *redis.Client, prefix string) *Log: NewWithClient wraps an existing redis.Client (for shared clients / custom options).
  • func Open(ctx context.Context, addr string) (*Log, error): Open connects to Redis at addr (e.g. "localhost:6379") and pings it.

Methods

  • func (l *Log) Append(ctx context.Context, entity, id, event string) (int64, error): Append durably appends an event to the entity's stream under id and returns its position, or returns the position already recorded for id.
  • func (l *Log) Close() error: Close closes the underlying Redis client.
  • func (l *Log) Events(ctx context.Context, entity string, from int64) ([]string, error): Events returns the entity's events at positions from onward, in log order.

Apache-2.0 licensed.