table

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Sep 29, 2024 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Copyright © 2024 Denys <https://github.com/AnyoneClown> This is my license. There are many like it, but this one is mine. My license is my best friend. It is my life. I must master it as I must master my life.

Copyright © 2024 Denys <https://github.com/AnyoneClown> This is my license. There are many like it, but this one is mine. My license is my best friend. It is my life. I must master it as I must master my life.

Index

Constants

This section is empty.

Variables

View Source
var TableCmd = &cobra.Command{
	Use:   "table",
	Short: "Display tables and their contents",
	Run: func(cmd *cobra.Command, args []string) {
		limit, _ := cmd.Flags().GetInt("rows")

		dsn, err := utils.GetDBString()
		if err != nil {
			fmt.Println("Error getting database string:", err)
			return
		}

		db, err := sqlx.Connect("postgres", dsn)
		if err != nil {
			fmt.Println("Error connecting to database:", err)
			return
		}
		defer db.Close()

		model, err := NewModel(db, limit)
		if err != nil {
			fmt.Println("Error initializing model:", err)
			return
		}
		if _, err := tea.NewProgram(model).Run(); err != nil {
			fmt.Println("Error running program:", err)
			return
		}
	},
}

Functions

func NewModel

func NewModel(db *sqlx.DB, limit int) (model, error)

Types

type Item

type Item struct {
	TableName string
}

func (Item) Description

func (i Item) Description() string

func (Item) FilterValue

func (i Item) FilterValue() string

func (Item) Title

func (i Item) Title() string

Jump to

Keyboard shortcuts

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