history

package
v0.7.6 Latest Latest
Warning

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

Go to latest
Published: Jun 15, 2024 License: Apache-2.0 Imports: 6 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const DefaultMaxHistoryItems = 1000
View Source
const HistoryCols = "" /* 206-byte string literal not displayed */
View Source
const HistoryQueryChunkSize = 1000

Variables

This section is empty.

Functions

func GetLastHistoryLineNum

func GetLastHistoryLineNum(ctx context.Context, screenId string) (int, error)

func GetLineCmdsFromHistoryItems

func GetLineCmdsFromHistoryItems(ctx context.Context, historyItems []*HistoryItemType) ([]*sstore.LineType, []*sstore.CmdType, error)

func InsertHistoryItem

func InsertHistoryItem(ctx context.Context, hitem *HistoryItemType) error

func PurgeHistoryByIds

func PurgeHistoryByIds(ctx context.Context, historyIds []string) error

Types

type HistoryInfoType

type HistoryInfoType struct {
	HistoryType string             `json:"historytype"`
	SessionId   string             `json:"sessionid,omitempty"`
	ScreenId    string             `json:"screenid,omitempty"`
	Items       []*HistoryItemType `json:"items"`
	Show        bool               `json:"show"`
}

func (HistoryInfoType) GetType

func (HistoryInfoType) GetType() string

type HistoryItemType

type HistoryItemType struct {
	HistoryId  string               `json:"historyid"`
	Ts         int64                `json:"ts"`
	UserId     string               `json:"userid"`
	SessionId  string               `json:"sessionid"`
	ScreenId   string               `json:"screenid"`
	LineId     string               `json:"lineid"`
	HadError   bool                 `json:"haderror"`
	CmdStr     string               `json:"cmdstr"`
	Remote     sstore.RemotePtrType `json:"remote"`
	IsMetaCmd  bool                 `json:"ismetacmd"`
	ExitCode   *int64               `json:"exitcode,omitempty"`
	DurationMs *int64               `json:"durationms,omitempty"`
	FeState    sstore.FeStateType   `json:"festate,omitempty"`
	Tags       map[string]bool      `json:"tags,omitempty"`
	LineNum    int64                `json:"linenum" dbmap:"-"`
	Status     string               `json:"status"`

	// only for updates
	Remove bool `json:"remove" dbmap:"-"`

	// transient (string because of different history orderings)
	HistoryNum string `json:"historynum" dbmap:"-"`
}

func GetHistoryItemByLineNum

func GetHistoryItemByLineNum(ctx context.Context, screenId string, lineNum int) (*HistoryItemType, error)

func (*HistoryItemType) FromMap

func (h *HistoryItemType) FromMap(m map[string]interface{}) bool

func (*HistoryItemType) ToMap

func (h *HistoryItemType) ToMap() map[string]interface{}

type HistoryQueryOpts

type HistoryQueryOpts struct {
	Offset     int
	MaxItems   int
	FromTs     int64
	SearchText string
	SessionId  string
	RemoteId   string
	ScreenId   string
	NoMeta     bool
	RawOffset  int
	FilterFn   func(*HistoryItemType) bool
}

type HistoryQueryResult

type HistoryQueryResult struct {
	MaxItems      int
	Items         []*HistoryItemType
	Offset        int // the offset shown to user
	RawOffset     int // internal offset
	HasMore       bool
	NextRawOffset int // internal offset used by pager for next query
	// contains filtered or unexported fields
}

func GetHistoryItems

func GetHistoryItems(ctx context.Context, opts HistoryQueryOpts) (*HistoryQueryResult, error)

type HistoryViewData

type HistoryViewData struct {
	Items         []*HistoryItemType `json:"items"`
	Offset        int                `json:"offset"`
	RawOffset     int                `json:"rawoffset"`
	NextRawOffset int                `json:"nextrawoffset"`
	HasMore       bool               `json:"hasmore"`
	Lines         []*sstore.LineType `json:"lines"`
	Cmds          []*sstore.CmdType  `json:"cmds"`
}

Jump to

Keyboard shortcuts

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