component

package
v0.1.4 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	ContentComponent   = "Content"
	JsonViewComponent  = "JsonView"
	QueryBarComponent  = "QueryBar"
	SortBarComponent   = "SortBar"
	ContentDeleteModal = "ContentDeleteModal"
)
View Source
const (
	DatabaseComponent = "Database"
	FilterBarView     = "FilterBar"
)
View Source
const (
	InputModalView        = "InputModal"
	ConfirmModalView      = "ConfirmModal"
	DatabaseTreeComponent = "DatabaseTree"
	DatabaseDeleteModal   = "DatabaseDeleteModal"
)
View Source
const (
	DocModifierView = "DocModifier"
)
View Source
const (
	HeaderComponent = "Header"
)
View Source
const (
	PeekerComponent = "Peeker"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type BaseInfo

type BaseInfo map[order]info

type Content

type Content struct {
	*core.BaseElement
	*core.Flex
	// contains filtered or unexported fields
}

Content is a view that displays documents in a table

func NewContent

func NewContent() *Content

func (*Content) HandleDatabaseSelection

func (c *Content) HandleDatabaseSelection(ctx context.Context, db, coll string) error

HandleDatabaseSelection is called when a database/collection is selected in the DatabaseTree

func (*Content) Render

func (c *Content) Render(setFocus bool)

func (*Content) UpdateDao

func (c *Content) UpdateDao(dao *mongo.Dao)

type Database

type Database struct {
	*core.BaseElement
	*core.Flex

	DbTree *DatabaseTree
	// contains filtered or unexported fields
}

Database is flex container for DatabaseTree and InputBar

func NewDatabase

func NewDatabase() *Database

func (*Database) Render

func (d *Database) Render()

func (*Database) SetSelectFunc

func (d *Database) SetSelectFunc(f func(ctx context.Context, db string, coll string) error)

type DatabaseTree

type DatabaseTree struct {
	*core.BaseElement
	*core.TreeView
	// contains filtered or unexported fields
}

func NewDatabaseTree

func NewDatabaseTree() *DatabaseTree

func (*DatabaseTree) RefreshStyle

func (t *DatabaseTree) RefreshStyle()

func (*DatabaseTree) Render

func (t *DatabaseTree) Render(ctx context.Context, dbsWitColls []mongo.DBsWithCollections, expand bool)

func (*DatabaseTree) SetSelectFunc

func (t *DatabaseTree) SetSelectFunc(f func(ctx context.Context, db string, coll string) error)

type DocModifier

type DocModifier struct {
	*core.BaseElement
}

DocModifier is a view that allows editing JSON documents

func NewDocModifier

func NewDocModifier() *DocModifier

func (*DocModifier) Duplicate

func (d *DocModifier) Duplicate(ctx context.Context, db, coll string, rawDocument string) (primitive.ObjectID, error)

Duplicate opens the editor with the document and saves it as a new document

func (*DocModifier) Edit

func (d *DocModifier) Edit(ctx context.Context, db, coll string, _id interface{}, jsonDoc string) (string, error)

Edit opens the editor with the document and saves it if it was changed

func (*DocModifier) Insert

func (d *DocModifier) Insert(ctx context.Context, db, coll string) (primitive.ObjectID, error)
type Header struct {
	*core.BaseElement
	*core.Table
	// contains filtered or unexported fields
}

Header is a view that displays basic information and keybindings in the header

func NewHeader

func NewHeader() *Header

NewHeader creates a new header view

func (*Header) Render

func (h *Header) Render()

Render renders the header view

func (*Header) SetBaseInfo

func (h *Header) SetBaseInfo() BaseInfo

SetBaseInfo sets the basic information about the database connection

func (*Header) UpdateKeys

func (h *Header) UpdateKeys() ([]config.Key, error)

UpdateKeys updates the keybindings for the current focused element

type InputBar

type InputBar struct {
	*core.BaseElement
	*core.InputField
	// contains filtered or unexported fields
}

func NewInputBar

func NewInputBar(barId tview.Identifier, label string) *InputBar

func (*InputBar) DoneFuncHandler

func (i *InputBar) DoneFuncHandler(accept func(string), reject func())

DoneFuncHandler sets DoneFunc for the input bar It accepts two functions: accept and reject which are called when user accepts or rejects the input

func (*InputBar) EnableAutocomplete

func (i *InputBar) EnableAutocomplete()

EnableAutocomplete enables autocomplete

func (*InputBar) EnableHistory

func (i *InputBar) EnableHistory()

EnableHistory enables history modal

func (*InputBar) LoadNewKeys

func (i *InputBar) LoadNewKeys(keys []string)

LoadNewKeys loads new keys for autocomplete It is used when switching databases or collections

func (*InputBar) SetDefaultText

func (i *InputBar) SetDefaultText(text string)

SetDefaultText sets default text for the input bar

func (*InputBar) Toggle

func (i *InputBar) Toggle(text string)

Draws default text if input is empty

type Peeker

type Peeker struct {
	*core.BaseElement
	*core.ViewModal
	// contains filtered or unexported fields
}

Peeker is a view that provides a modal view for peeking at a document

func NewPeeker

func NewPeeker() *Peeker

NewPeeker creates a new Peeker view

func (*Peeker) MoveToBottom

func (p *Peeker) MoveToBottom()

func (*Peeker) MoveToTop

func (p *Peeker) MoveToTop()

func (*Peeker) Render

func (p *Peeker) Render(ctx context.Context, state *mongo.CollectionState, _id interface{}) error

func (*Peeker) SetDoneFunc

func (p *Peeker) SetDoneFunc(doneFunc func())

type ViewType

type ViewType int
const (
	TableView ViewType = iota
	JsonView
	SingleLineView
)

Jump to

Keyboard shortcuts

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