wstore

package
v0.10.4 Latest Latest
Warning

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

Go to latest
Published: Dec 21, 2024 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const OldDBName = "~/.waveterm/waveterm.db"
View Source
const WStoreDBName = "waveterm.db"

Variables

View Source
var ErrNotFound = fmt.Errorf("not found")

Functions

func DBDelete

func DBDelete(ctx context.Context, otype string, id string) error

func DBExistsORef

func DBExistsORef(ctx context.Context, oref waveobj.ORef) (bool, error)

func DBFindTabForBlockId

func DBFindTabForBlockId(ctx context.Context, blockId string) (string, error)

func DBFindWindowForWorkspaceId added in v0.10.0

func DBFindWindowForWorkspaceId(ctx context.Context, workspaceId string) (string, error)

func DBFindWorkspaceForTabId added in v0.9.0

func DBFindWorkspaceForTabId(ctx context.Context, tabId string) (string, error)

func DBGet

func DBGet[T waveobj.WaveObj](ctx context.Context, id string) (T, error)

func DBGetAllOIDsByType added in v0.10.0

func DBGetAllOIDsByType(ctx context.Context, otype string) ([]string, error)

func DBGetAllObjsByType added in v0.10.0

func DBGetAllObjsByType[T waveobj.WaveObj](ctx context.Context, otype string) ([]T, error)

func DBGetBlockViewCounts added in v0.10.0

func DBGetBlockViewCounts(ctx context.Context) (map[string]int, error)

func DBGetCount

func DBGetCount[T waveobj.WaveObj](ctx context.Context) (int, error)

func DBGetORef

func DBGetORef(ctx context.Context, oref waveobj.ORef) (waveobj.WaveObj, error)

func DBGetSingleton

func DBGetSingleton[T waveobj.WaveObj](ctx context.Context) (T, error)

func DBGetSingletonByType

func DBGetSingletonByType(ctx context.Context, otype string) (waveobj.WaveObj, error)

func DBGetWSCounts added in v0.10.0

func DBGetWSCounts(ctx context.Context) (int, int, error)

returns (num named workespaces, num total workspaces, error)

func DBInsert

func DBInsert(ctx context.Context, val waveobj.WaveObj) error

func DBMustGet

func DBMustGet[T waveobj.WaveObj](ctx context.Context, id string) (T, error)

func DBResolveEasyOID

func DBResolveEasyOID(ctx context.Context, oid string) (*waveobj.ORef, error)

func DBSelectMap

func DBSelectMap[T waveobj.WaveObj](ctx context.Context, ids []string) (map[string]T, error)

func DBSelectORefs

func DBSelectORefs(ctx context.Context, orefs []waveobj.ORef) ([]waveobj.WaveObj, error)

func DBUpdate

func DBUpdate(ctx context.Context, val waveobj.WaveObj) error

func GetDBName

func GetDBName() string

func GetOldDBName

func GetOldDBName() string

func InitWStore

func InitWStore() error

func MakeDB

func MakeDB(ctx context.Context) (*sqlx.DB, error)

func MakeOldDB

func MakeOldDB(ctx context.Context) (*sqlx.DB, error)

func MoveBlockToTab

func MoveBlockToTab(ctx context.Context, currentTabId string, newTabId string, blockId string) error

func ReplaceOldHistory

func ReplaceOldHistory(ctx context.Context, hist []*OldHistoryType) error

func TryMigrateOldHistory

func TryMigrateOldHistory() error

func UpdateObjectMeta

func UpdateObjectMeta(ctx context.Context, oref waveobj.ORef, meta waveobj.MetaMapType, mergeSpecial bool) error

func UpdateTabName

func UpdateTabName(ctx context.Context, tabId, name string) error

func WithTx

func WithTx(ctx context.Context, fn func(tx *TxWrap) error) (rtnErr error)

func WithTxRtn

func WithTxRtn[RT any](ctx context.Context, fn func(tx *TxWrap) (RT, error)) (rtnVal RT, rtnErr error)

Types

type OldHistoryType

type OldHistoryType struct {
	HistoryId  string
	Ts         int64
	RemoteName string
	HadError   bool
	CmdStr     string
	ExitCode   int
	DurationMs int64
}

func GetAllOldHistory

func GetAllOldHistory() ([]*OldHistoryType, error)

type TxWrap

type TxWrap = txwrap.TxWrap

Jump to

Keyboard shortcuts

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