cmd

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Mar 7, 2025 License: MIT Imports: 15 Imported by: 0

Documentation

Overview

Copyright © 2024 Zac Orndorff <zac@orndorff.dev>

Copyright © 2024 NAME HERE <zac@orndorff.dev>

Copyright © 2024 Zac Orndorff zac@orndorff.dev

Copyright © Zac Orndorff <zac@orndorff.dev>

Copyright © Zac Orndorff zac@orndorff.dev

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Execute

func Execute()

Execute adds all child commands to the root command and sets flags appropriately. This is called by main.main(). It only needs to happen once to the rootCmd.

func InitConfig

func InitConfig()

initConfig reads in config file and ENV variables if set.

func InitDatabaseClient

func InitDatabaseClient() func(*DatabaseClient)

func OpenConnection

func OpenConnection(conn DatabaseClient) (*sql.DB, error)

func Prepare

func Prepare(db *sql.DB, query string) (*sql.Stmt, error)

func Query

func Query(db *sql.DB, query string) (*sql.Rows, error)

func SetJsonHandler

func SetJsonHandler(logLevel *slog.LevelVar)

func SetLogLevel

func SetLogLevel(stringLevel string, logLevel *slog.LevelVar)

func ToJsonString

func ToJsonString(data interface{}) (string, error)

func WithBootQueries

func WithBootQueries(queries []string) func(*DatabaseClient)

func WithConnectionsByName

func WithConnectionsByName(connectionNames []string) func(*DatabaseClient)

Setup the connectionConfig with the connection details, plugins.

func WithDatabasePath

func WithDatabasePath(path string) func(*DatabaseClient)

func WithNumThreads

func WithNumThreads(num int) func(*DatabaseClient)

func WithPlugins

func WithPlugins(plugins []string) func(*DatabaseClient)

func WithWorkspace

func WithWorkspace(workspace string) func(*DatabaseClient)

Types

type Config

type Config struct {
	NumThreads   int
	Plugins      []string
	Connections  []connection.ConnectionConfig
	DatabasePath string
	Workspace    string
	BootQueries  []string
}

type DatabaseClient

type DatabaseClient struct {
	*duckdb.Connector
	// contains filtered or unexported fields
}

func NewDatabaseClient

func NewDatabaseClient(options ...func(*DatabaseClient)) *DatabaseClient

Jump to

Keyboard shortcuts

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