database

package
v1.1.14 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AutoMigrate

func AutoMigrate(service session.Service) error

AutoMigrate runs the GORM auto-migration tool to ensure the database schema matches the internal storage models (e.g., storageSession, storageEvent).

NOTE: This function relies on a type assertion to the concrete *databaseService implementation. It will return an error if the provided session.Service is a different implementation.

func NewSessionService

func NewSessionService(dialector gorm.Dialector, opts ...gorm.Option) (session.Service, error)

NewSessionService creates a new session.Service implementation that uses a relational database (e.g., PostgreSQL, Spanner, SQLite) via the GORM library.

It requires a gorm.Dialector to specify the database connection and accepts optional gorm.Option values for further GORM configuration.

It returns the new session.Service or an error if the database connection gorm.Open fails.

Types

type LocalSession

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

TODO LocalSession is identical to session.session. Move to sessioninternal

func (*LocalSession) AppName

func (s *LocalSession) AppName() string

func (*LocalSession) Events

func (s *LocalSession) Events() session.Events

func (*LocalSession) ID

func (s *LocalSession) ID() string

func (*LocalSession) LastUpdateTime

func (s *LocalSession) LastUpdateTime() time.Time

func (*LocalSession) State

func (s *LocalSession) State() session.State

func (*LocalSession) UserID

func (s *LocalSession) UserID() string

Jump to

Keyboard shortcuts

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