wstore

package
v0.8.8-beta.2 Latest Latest
Warning

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

Go to latest
Published: Oct 1, 2024 License: Apache-2.0 Imports: 16 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 CreateBlock

func CreateBlock(ctx context.Context, tabId string, blockDef *waveobj.BlockDef, rtOpts *waveobj.RuntimeOpts) (*waveobj.Block, error)

func CreateTab

func CreateTab(ctx context.Context, workspaceId string, name string) (*waveobj.Tab, error)

func CreateWorkspace

func CreateWorkspace(ctx context.Context) (*waveobj.Workspace, error)

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 DBFindWindowForTabId

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

func DBGet

func DBGet[T waveobj.WaveObj](ctx context.Context, id string) (T, 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 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 DeleteBlock

func DeleteBlock(ctx context.Context, tabId string, blockId string) error

func DeleteTab

func DeleteTab(ctx context.Context, workspaceId string, tabId string) error

must delete all blocks individually first also deletes LayoutState

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 SetActiveTab

func SetActiveTab(ctx context.Context, windowId string, tabId string) error

func TryMigrateOldHistory

func TryMigrateOldHistory() error

func UpdateObjectMeta

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

func UpdateTabName

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

func UpdateWorkspaceTabIds

func UpdateWorkspaceTabIds(ctx context.Context, workspaceId string, tabIds []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