db

package
v0.0.0-...-1950331 Latest Latest
Warning

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

Go to latest
Published: Jun 9, 2021 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func OpenDB

func OpenDB() *bolt.DB

func WriteOperation

func WriteOperation(batchId int, input string, output string) error

Types

type Batch

type Batch struct {
	Id            int       `json:"Id"`
	CommandType   string    `json:"CommandType"`
	Command       []string  `json:"Command"`
	CommandString string    `json:"CommandString"`
	WorkingDir    string    `json:"WorkingDir"`
	Undoable      bool      `json:"Undoable"`
	Undone        bool      `json:"Undone"`
	Date          time.Time `json:"Date"`
}

func GetLastNonUndone

func GetLastNonUndone() (Batch, error)

func NewBatch

func NewBatch(commandType string, command []string, workingDir string) Batch

func (Batch) Close

func (b Batch) Close()

func (Batch) Undo

func (batch Batch) Undo() error

type BatchList

type BatchList []Batch

func GetBatches

func GetBatches() (BatchList, error)

func (BatchList) Close

func (b BatchList) Close()

func (BatchList) GetPage

func (b BatchList) GetPage(page int, batchesPerPage int) (batchList BatchList, pageBefore bool, pageAfter bool)

func (BatchList) Reverse

func (b BatchList) Reverse() BatchList

func (BatchList) ToTableData

func (b BatchList) ToTableData() pterm.TableData

type Favorite

type Favorite struct {
	Id            int      `json:"Id"`
	Name          string   `json:"Name"`
	Command       []string `json:"Command"`
	CommandType   string   `json:"CommandType"`
	CommandString string   `json:"CommandString"`
}

func GetFavoriteByName

func GetFavoriteByName(name string) Favorite

func NewFavorite

func NewFavorite(name string, commandType string, command string) (Favorite, error)

type FavoriteList

type FavoriteList []Favorite

type Operation

type Operation struct {
	Id      int    `json:"Id"`
	BatchId int    `json:"BatchId"`
	Input   string `json:"Input"`
	Output  string `json:"Output"`
	Undone  bool   `json:"Undone"`
}

type OperationList

type OperationList []Operation

func GetOperationsForBatch

func GetOperationsForBatch(batchId int) (OperationList, error)

func (OperationList) ToTableData

func (ops OperationList) ToTableData(cwd string) pterm.TableData

func (OperationList) Undo

func (ops OperationList) Undo(commandType string, cwd string) error

Jump to

Keyboard shortcuts

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