component

package
v0.1.22 Latest Latest
Warning

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

Go to latest
Published: Jan 27, 2025 License: Apache-2.0 Imports: 29 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ContentId            = "Content"
	JsonViewId           = "JsonView"
	QueryBarId           = "QueryBar"
	SortBarId            = "SortBar"
	ContentDeleteModalId = "ContentDeleteModal"
)
View Source
const (
	DatabaseId  = "Database"
	FilterBarId = "FilterBar"
)
View Source
const (
	InputModalId          = "InputModal"
	ConfirmModalId        = "ConfirmModal"
	DatabaseTreeId        = "DatabaseTree"
	DatabaseDeleteModalId = "DatabaseDeleteModal"
)
View Source
const (
	IndexId            = "Index"
	IndexAddFormId     = "IndexAddForm"
	IndexDeleteModalId = "IndexDeleteModal"
)
View Source
const (
	AIQueryId = "AIQuery"
)
View Source
const (
	DocModifierId = "DocModifier"
)
View Source
const (
	HeaderId = "Header"
)
View Source
const (
	PeekerId = "Peeker"
)
View Source
const (
	TabBarId = "TabBar"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AIQuery added in v0.1.11

type AIQuery struct {
	*core.BaseElement
	*core.FormModal
	// contains filtered or unexported fields
}

func NewAIQuery added in v0.1.11

func NewAIQuery() *AIQuery

func (*AIQuery) IsAIQueryFocused added in v0.1.11

func (a *AIQuery) IsAIQueryFocused() bool

func (*AIQuery) Render added in v0.1.11

func (a *AIQuery) Render()

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()

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) IsFocused added in v0.1.9

func (d *Database) IsFocused() bool

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 Index added in v0.1.5

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

func NewIndex added in v0.1.5

func NewIndex() *Index

func (*Index) HandleDatabaseSelection added in v0.1.5

func (i *Index) HandleDatabaseSelection(ctx context.Context, db, coll string) error

func (*Index) InsertPairedFields added in v0.1.22

func (i *Index) InsertPairedFields(pos int)

func (*Index) IsAddFormFocused added in v0.1.9

func (i *Index) IsAddFormFocused() bool

func (*Index) Render added in v0.1.5

func (i *Index) Render()

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 TabBar added in v0.1.5

type TabBar struct {
	*core.BaseElement
	*core.Table
	// contains filtered or unexported fields
}

func NewTabBar added in v0.1.5

func NewTabBar() *TabBar

func (*TabBar) AddTab added in v0.1.5

func (t *TabBar) AddTab(name string, component TabBarPrimitive, defaultTab bool)

func (*TabBar) GetActiveComponent added in v0.1.5

func (t *TabBar) GetActiveComponent() TabBarPrimitive

func (*TabBar) GetActiveComponentAndRender added in v0.1.10

func (t *TabBar) GetActiveComponentAndRender() TabBarPrimitive

func (*TabBar) GetActiveTabIndex added in v0.1.5

func (t *TabBar) GetActiveTabIndex() int

func (*TabBar) NextTab added in v0.1.5

func (t *TabBar) NextTab()

func (*TabBar) PreviousTab added in v0.1.5

func (t *TabBar) PreviousTab()

func (*TabBar) Render added in v0.1.5

func (t *TabBar) Render()

type TabBarComponent added in v0.1.5

type TabBarComponent struct {
	// contains filtered or unexported fields
}

type TabBarPrimitive added in v0.1.5

type TabBarPrimitive interface {
	tview.Primitive
	Render()
}

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
JackTT - Gopher 🇻🇳