database

package
v0.0.56 Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2022 License: MIT Imports: 8 Imported by: 5

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DumpTable added in v0.0.21

func DumpTable(data *TableData) error

DumpTable prints the specified table to standard output stream

func DumpTables

func DumpTables(list []TableData) error

DumpTables prints the specified tables to standard output stream

func GetConnection

func GetConnection(config *Config) (*sql.DB, error)

GetConnection returns a SQL database connection

func GetPostgresConnection

func GetPostgresConnection(config *PostgresConfig) (*sql.DB, error)

GetPostgresConnection returns a PostgreSQL database connection

func GetValue

func GetValue(pval *interface{}) string

GetValue returns a typed value from a cell reference

Types

type Config

type Config struct {
	Server   string `yaml:"server" json:"server"`
	Port     int    `yaml:"port" json:"port"`
	Username string `yaml:"username" json:"username"`
	Password string `yaml:"password" json:"password"`
	Name     string `yaml:"name" json:"name"`
}

Config struct

type PostgresConfig

type PostgresConfig struct {
	Config `yaml:"config" json:"config"`
	UseSSL bool `yaml:"use_ssl" json:"use_ssl"`
}

PostgresConfig contains fields for PostgreSQL configuration

type TableData

type TableData struct {
	Rows    [][]interface{}
	Columns []string
}

TableData struct

func GetData

func GetData(conn *sql.DB, query string) (*TableData, error)

GetData returns data retrieved by using query with conn

Jump to

Keyboard shortcuts

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