read

package
v0.79.0 Latest Latest
Warning

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

Go to latest
Published: Sep 16, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Cmd = &cobra.Command{
	Use:   "read",
	Short: "Read SQLite file",
	Args:  cobra.NoArgs,
	Run: func(c *cobra.Command, args []string) {
		db, err := sqlite_utils.OpenSQLite(FlagFile)
		if err != nil {
			fmt.Println(err)
		}

		tables := sqlite_utils.GetTables(db)

		if FlagTable == "" {
			for _, table := range tables {
				fmt.Println("Table: ", table)
				sqlite_utils.PrintTable(db, table)
				fmt.Println("")
			}
		} else {
			for _, table := range tables {
				if table == FlagTable {
					fmt.Println("Table: ", table)
					sqlite_utils.PrintTable(db, table)
					os.Exit(0)
				}
			}
			log.Fatal(fmt.Errorf("table %s not found", FlagTable))
		}
	},
}
View Source
var FlagFile string
View Source
var FlagTable string

Functions

This section is empty.

Types

This section is empty.

Jump to

Keyboard shortcuts

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