fsdb

package
v1.4.452 Latest Latest
Warning

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

Go to latest
Published: May 4, 2026 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Context

type Context struct {
	Name    string
	Content string
}

type ContextsEntity

type ContextsEntity struct {
	*StorageEntity
}

func (*ContextsEntity) Get

func (o *ContextsEntity) Get(name string) (ret *Context, err error)

Get Load a context from file

func (*ContextsEntity) PrintContext

func (o *ContextsEntity) PrintContext(name string) (err error)

type Db

type Db struct {
	Dir string

	Patterns *PatternsEntity
	Sessions *SessionsEntity
	Contexts *ContextsEntity

	EnvFilePath string
}

func NewDb

func NewDb(dir string) (db *Db)

func (*Db) Configure

func (o *Db) Configure() (err error)

func (*Db) FilePath

func (o *Db) FilePath(fileName string) (ret string)

func (*Db) IsEnvFileExists

func (o *Db) IsEnvFileExists() (ret bool)

func (*Db) LoadEnvFile

func (o *Db) LoadEnvFile() (err error)

func (*Db) SaveEnv

func (o *Db) SaveEnv(content string) (err error)

type DirectoryChange

type DirectoryChange struct {
	Dir       string
	Timestamp time.Time
}

type Pattern

type Pattern struct {
	Name        string
	Description string
	Pattern     string
}

Pattern represents a single pattern with its metadata

type PatternsEntity

type PatternsEntity struct {
	*StorageEntity
	SystemPatternFile      string
	UniquePatternsFilePath string
	CustomPatternsDir      string
}

func (*PatternsEntity) Get

func (o *PatternsEntity) Get(name string) (*Pattern, error)

Get required for Storage interface

func (*PatternsEntity) GetApplyVariables

func (o *PatternsEntity) GetApplyVariables(
	source string, variables map[string]string, input string) (pattern *Pattern, err error)

GetApplyVariables main entry point for getting patterns from any source

func (*PatternsEntity) GetNames

func (o *PatternsEntity) GetNames() (ret []string, err error)

GetNames overrides StorageEntity.GetNames to include custom patterns directory

func (*PatternsEntity) GetRaw added in v1.4.429

func (o *PatternsEntity) GetRaw(name string) (*Pattern, error)

GetRaw returns a pattern from storage without applying variable processing.

func (*PatternsEntity) GetWithoutVariables added in v1.4.289

func (o *PatternsEntity) GetWithoutVariables(source, input string) (pattern *Pattern, err error)

GetWithoutVariables returns a pattern with only the {{input}} placeholder processed and skips template variable replacement

func (*PatternsEntity) ListNames

func (o *PatternsEntity) ListNames(shellCompleteList bool) (err error)

ListNames overrides StorageEntity.ListNames to use PatternsEntity.GetNames

func (*PatternsEntity) PrintLatestPatterns

func (o *PatternsEntity) PrintLatestPatterns(latestNumber int) (err error)

func (*PatternsEntity) PrintPattern added in v1.4.446

func (o *PatternsEntity) PrintPattern(name string) (err error)

PrintPattern prints the raw contents of the named pattern to the terminal. It checks the custom patterns directory first, then falls back to the main directory.

func (*PatternsEntity) Save

func (o *PatternsEntity) Save(name string, content []byte) (err error)

type Session

type Session struct {
	Name     string
	Messages []*chat.ChatCompletionMessage
	// contains filtered or unexported fields
}

func (*Session) Append

func (o *Session) Append(messages ...*chat.ChatCompletionMessage)

func (*Session) GetLastMessage

func (o *Session) GetLastMessage() (ret *chat.ChatCompletionMessage)

func (*Session) GetVendorMessages

func (o *Session) GetVendorMessages() (ret []*chat.ChatCompletionMessage)

func (*Session) IsEmpty

func (o *Session) IsEmpty() bool

func (*Session) String

func (o *Session) String() (ret string)

type SessionsEntity

type SessionsEntity struct {
	*StorageEntity
}

func (*SessionsEntity) Get

func (o *SessionsEntity) Get(name string) (session *Session, err error)

func (*SessionsEntity) PrintSession

func (o *SessionsEntity) PrintSession(name string) (err error)

func (*SessionsEntity) SaveSession

func (o *SessionsEntity) SaveSession(session *Session) (err error)

type StorageEntity

type StorageEntity struct {
	Label         string
	Dir           string
	ItemIsDir     bool
	FileExtension string
}

func (*StorageEntity) BuildFilePath

func (o *StorageEntity) BuildFilePath(fileName string) (ret string)

func (*StorageEntity) BuildFilePathByName

func (o *StorageEntity) BuildFilePathByName(name string) (ret string)

func (*StorageEntity) Configure

func (o *StorageEntity) Configure() (err error)

func (*StorageEntity) Delete

func (o *StorageEntity) Delete(name string) (err error)

func (*StorageEntity) Exists

func (o *StorageEntity) Exists(name string) (ret bool)

func (*StorageEntity) GetNames

func (o *StorageEntity) GetNames() (ret []string, err error)

GetNames finds all patterns in the patterns directory and enters the id, name, and pattern into a slice of Entry structs. it returns these entries or an error

func (*StorageEntity) ListNames

func (o *StorageEntity) ListNames(shellCompleteList bool) (err error)

func (*StorageEntity) Load

func (o *StorageEntity) Load(name string) (ret []byte, err error)

func (*StorageEntity) LoadAsJson

func (o *StorageEntity) LoadAsJson(name string, item any) (err error)

func (*StorageEntity) Rename

func (o *StorageEntity) Rename(oldName, newName string) (err error)

func (*StorageEntity) Save

func (o *StorageEntity) Save(name string, content []byte) (err error)

func (*StorageEntity) SaveAsJson

func (o *StorageEntity) SaveAsJson(name string, item any) (err error)

Jump to

Keyboard shortcuts

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