db

package
v1.4.34 Latest Latest
Warning

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

Go to latest
Published: Oct 2, 2024 License: MIT Imports: 9 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 Contexts

type Contexts struct {
	*Storage
}

func (*Contexts) GetContext

func (o *Contexts) GetContext(name string) (ret *Context, err error)

GetContext Load a context from file

type Db

type Db struct {
	Dir string

	Patterns *Patterns
	Sessions *Sessions
	Contexts *Contexts

	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
}

type Patterns

type Patterns struct {
	*Storage
	SystemPatternFile      string
	UniquePatternsFilePath string
}

func (*Patterns) GetPattern

func (o *Patterns) GetPattern(name string, variables map[string]string) (ret *Pattern, err error)

GetPattern finds a pattern by name and returns the pattern as an entry or an error

func (*Patterns) PrintLatestPatterns

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

type Session

type Session struct {
	Name     string
	Messages []*common.Message
}

func (*Session) Append

func (o *Session) Append(messages ...*common.Message)

func (*Session) IsEmpty

func (o *Session) IsEmpty() bool

type Sessions

type Sessions struct {
	*Storage
}

func (*Sessions) GetOrCreateSession

func (o *Sessions) GetOrCreateSession(name string) (session *Session, err error)

func (*Sessions) SaveSession

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

type Storage

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

func (*Storage) BuildFilePath

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

func (*Storage) BuildFilePathByName

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

func (*Storage) Configure

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

func (*Storage) Delete

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

func (*Storage) Exists

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

func (*Storage) GetNames

func (o *Storage) 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 (*Storage) ListNames

func (o *Storage) ListNames() (err error)

func (*Storage) Load

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

func (*Storage) LoadAsJson

func (o *Storage) LoadAsJson(name string, item interface{}) (err error)

func (*Storage) Rename

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

func (*Storage) Save

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

func (*Storage) SaveAsJson

func (o *Storage) SaveAsJson(name string, item interface{}) (err error)

Jump to

Keyboard shortcuts

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