history

package
v0.0.47 Latest Latest
Warning

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

Go to latest
Published: May 14, 2025 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EventFileCreated         pubsub.EventType = "history_file_created"
	EventFileVersionCreated  pubsub.EventType = "history_file_version_created"
	EventFileUpdated         pubsub.EventType = "history_file_updated"
	EventFileDeleted         pubsub.EventType = "history_file_deleted"
	EventSessionFilesDeleted pubsub.EventType = "history_session_files_deleted"
)
View Source
const (
	InitialVersion = "initial"
)

Variables

This section is empty.

Functions

func Delete

func Delete(ctx context.Context, id string) error

func DeleteSessionFiles

func DeleteSessionFiles(ctx context.Context, sessionID string) error

func InitService

func InitService(sqlDatabase *sql.DB) error

func Subscribe

func Subscribe(ctx context.Context) <-chan pubsub.Event[File]

Types

type File

type File struct {
	ID        string
	SessionID string
	Path      string
	Content   string
	Version   string
	CreatedAt time.Time
	UpdatedAt time.Time
}

func Create

func Create(ctx context.Context, sessionID, path, content string) (File, error)

func CreateVersion

func CreateVersion(ctx context.Context, sessionID, path, content string) (File, error)

func Get

func Get(ctx context.Context, id string) (File, error)

func GetByPathAndVersion

func GetByPathAndVersion(ctx context.Context, sessionID, path, version string) (File, error)

func GetLatestByPathAndSession

func GetLatestByPathAndSession(ctx context.Context, path, sessionID string) (File, error)

func ListBySession

func ListBySession(ctx context.Context, sessionID string) ([]File, error)

func ListLatestSessionFiles

func ListLatestSessionFiles(ctx context.Context, sessionID string) ([]File, error)

func ListVersionsByPath

func ListVersionsByPath(ctx context.Context, path string) ([]File, error)

func Update

func Update(ctx context.Context, file File) (File, error)

type Service

type Service interface {
	pubsub.Subscriber[File]

	Create(ctx context.Context, sessionID, path, content string) (File, error)
	CreateVersion(ctx context.Context, sessionID, path, content string) (File, error)
	Get(ctx context.Context, id string) (File, error)
	GetByPathAndVersion(ctx context.Context, sessionID, path, version string) (File, error)
	GetLatestByPathAndSession(ctx context.Context, path, sessionID string) (File, error)
	ListBySession(ctx context.Context, sessionID string) ([]File, error)
	ListLatestSessionFiles(ctx context.Context, sessionID string) ([]File, error)
	ListVersionsByPath(ctx context.Context, path string) ([]File, error)
	Update(ctx context.Context, file File) (File, error)
	Delete(ctx context.Context, id string) error
	DeleteSessionFiles(ctx context.Context, sessionID string) error
}

func GetService

func GetService() Service

Jump to

Keyboard shortcuts

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