sqlite

package
v0.35.0 Latest Latest
Warning

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

Go to latest
Published: Dec 29, 2025 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

Package sqlite provides a SQLite-based implementation of the session.Service interface. This is ideal for desktop applications and single-user scenarios where a lightweight, file-based database is preferred over PostgreSQL or MySQL.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Service

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

Service implements session.Service using SQLite.

func New

func New(dbPath string) (*Service, error)

New creates a new SQLite session service. dbPath is the path to the SQLite database file. If the file doesn't exist, it will be created.

func (*Service) AppendEvent

func (s *Service) AppendEvent(ctx context.Context, sessionID string, event *session.Event) error

AppendEvent adds an event to a session.

func (*Service) Close

func (s *Service) Close() error

Close closes the database connection.

func (*Service) Create

func (s *Service) Create(ctx context.Context, req *session.CreateRequest) (session.Session, error)

Create creates a new session.

func (*Service) Delete

func (s *Service) Delete(ctx context.Context, sessionID string) error

Delete deletes a session and all its events.

func (*Service) Get

Get retrieves a session by ID.

func (*Service) GetEvents

func (s *Service) GetEvents(ctx context.Context, sessionID string, filter *session.EventFilter) ([]session.Event, error)

GetEvents retrieves events for a session.

func (*Service) List

func (s *Service) List(ctx context.Context, req *session.ListRequest) ([]*session.Session, error)

List lists sessions for an app and user.

func (*Service) Update

func (s *Service) Update(ctx context.Context, req *session.UpdateRequest) error

Update updates a session's metadata.

func (*Service) UpdateState

func (s *Service) UpdateState(ctx context.Context, sessionID string, delta map[string]any) error

UpdateState updates session state.

Jump to

Keyboard shortcuts

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