sqlite

package
v1.7.4 Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2026 License: Apache-2.0 Imports: 14 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package sqlite is a store of webhooks, and their calls, in a SQLite database, which is created when it doesn't exist, or in memory, of sqlite.Memory, such as for tests

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Opt

type Opt func(*Store) error

Opt is an option of the store

func WithBroadcaster

func WithBroadcaster(b sqlite.Publisher) Opt

WithBroadcaster publishes the webhooks, and calls, which are created, updated and deleted, once they're committed, as changes of the schema store.Schema, and the tables store.WebhookTable, and store.CallTable, whose rows are their serial numbers, including the calls which are deleted with their webhook, and those which are deleted, as they're old

func WithTracer

func WithTracer(tracer trace.Tracer) Opt

WithTracer traces the store's methods, but not their queries, whose arguments include the webhooks' secrets, and what services sent

type Store

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

Store is a store of webhooks, and their calls, in a SQLite database

func New

func New(ctx context.Context, path string, opts ...Opt) (_ *Store, err error)

New returns a store of the path of its database file, such as /data/llm/webhook.db, or sqlite.Memory, which is created when it doesn't exist, with its schema

func (*Store) Close

func (self *Store) Close() error

Close closes the database

func (*Store) CreateCall

func (self *Store) CreateCall(ctx context.Context, call webhook.Call) (_ webhook.Call, err error)

CreateCall adds the call, once its webhook is known to be there, in a transaction, so it isn't deleted between them

func (*Store) CreateWebhook

func (self *Store) CreateWebhook(ctx context.Context, meta webhook.WebhookMeta, hash []byte) (_ webhook.Webhook, err error)

func (*Store) DeleteCall added in v1.7.4

func (self *Store) DeleteCall(ctx context.Context, id uint64) (_ webhook.Call, err error)

func (*Store) DeleteCalls

func (self *Store) DeleteCalls(ctx context.Context, before time.Time) (_ uint64, err error)

func (*Store) DeleteWebhook

func (self *Store) DeleteWebhook(ctx context.Context, id uint64) (_ webhook.Webhook, err error)

func (*Store) GetCall

func (self *Store) GetCall(ctx context.Context, id uint64) (_ webhook.Call, err error)

func (*Store) GetWebhook

func (self *Store) GetWebhook(ctx context.Context, id uint64) (_ webhook.Webhook, err error)

func (*Store) GetWebhookByHash

func (self *Store) GetWebhookByHash(ctx context.Context, hash []byte) (_ webhook.Webhook, err error)

func (*Store) ListCalls

func (self *Store) ListCalls(ctx context.Context, req webhook.CallListRequest) (_ webhook.CallList, err error)

func (*Store) ListWebhooks

func (self *Store) ListWebhooks(ctx context.Context, req webhook.WebhookListRequest) (_ webhook.WebhookList, err error)

func (*Store) UpdateWebhook

func (self *Store) UpdateWebhook(ctx context.Context, id uint64, req webhook.WebhookRequest) (_ webhook.Webhook, err error)

Directories

Path Synopsis
Package schema is the schema of the SQLite store of webhooks: its tables, its queries, and the types which are read from, and written to, them
Package schema is the schema of the SQLite store of webhooks: its tables, its queries, and the types which are read from, and written to, them

Jump to

Keyboard shortcuts

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