Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( ErrAlreadyRegistered = errors.New("driver already registered") ErrNotRegistered = errors.New("driver not registered") )
Functions ¶
This section is empty.
Types ¶
type ConnAlias ¶
type ConnAlias struct {
// contains filtered or unexported fields
}
ConnAlias represents a connection with alias support for table names.
func NewConnAlias ¶
NewConnAlias creates a new ConnAlias instance with the given connection.
type ConnProxy ¶
type ConnProxy struct {
// contains filtered or unexported fields
}
ConnProxy wraps a Conn and allows dynamic replacement with concurrency safety.
func NewConnProxy ¶
NewConnProxy returns a new ConnProxy that wraps the given Conn.
type Cursor ¶
type Cursor interface {
All(ctx context.Context, val any) error
Next(ctx context.Context) bool
Decode(val any) error
Close(ctx context.Context) error
}
Cursor defines the interface for iterating over a collection of documents.
type DeleteOptions ¶
type DeleteOptions struct {
}
DeleteOptions represents options when deleting documents.
type Event ¶
type Event struct {
ID uuid.UUID `json:"id" yaml:"id" validate:"required"`
OP string `json:"op" yaml:"op" validate:"required"`
}
Event represents a change event within the store.
type FindOptions ¶
FindOptions represents options when finding documents.
type IndexOptions ¶
IndexOptions represents options when creating an index.
type InsertOptions ¶
type InsertOptions struct {
}
InsertOptions represents options when inserting documents.
type Proxy ¶
type Proxy struct {
// contains filtered or unexported fields
}
Proxy wraps a Driver and allows dynamic replacement with concurrency safety.
type Registry ¶
type Registry struct {
// contains filtered or unexported fields
}
Registry manages a collection of drivers.
func NewRegistry ¶
func NewRegistry() *Registry
NewRegistry creates and returns a new Registry instance.
func (*Registry) Lookup ¶
Lookup retrieves a driver by its name. Returns an error if the driver is not found.
func (*Registry) Register ¶
Register adds a driver to the registry. Returns an error if the driver already exists.
func (*Registry) Unregister ¶
Unregister removes a driver from the registry. Returns an error if the driver is not found.
type Store ¶
type Store interface {
Watch(ctx context.Context, filter any) (Stream, error)
Index(ctx context.Context, keys []string, opts ...IndexOptions) error
Unindex(ctx context.Context, keys []string) error
Insert(ctx context.Context, docs []any, opts ...InsertOptions) error
Update(ctx context.Context, filter, update any, opts ...UpdateOptions) (int, error)
Delete(ctx context.Context, filter any, opts ...DeleteOptions) (int, error)
Find(ctx context.Context, filter any, opts ...FindOptions) (Cursor, error)
}
Store defines the interface for a basic document store.
type Stream ¶
type Stream interface {
Next(ctx context.Context) bool
Decode(val any) error
Close(ctx context.Context) error
}
Stream defines an interface for consuming event streams.
type UpdateOptions ¶
type UpdateOptions struct {
Upsert bool
}
UpdateOptions represents options when updating documents.