db

package
v0.3.4 Latest Latest
Warning

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

Go to latest
Published: Feb 13, 2026 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ResultFormatUndefined = iota
	ResultFormatMarkdown
	ResultFormatCSV
)

Variables

View Source
var ErrNoDatabaseNameDefined = errors.New("no database name defined")
View Source
var ErrNoHostDefined = errors.New("no host defined")
View Source
var ErrNoPortDefined = errors.New("no port defined")
View Source
var ErrNoUserDefined = errors.New("no user defined")
View Source
var ErrTransactionHasBeenCommittedOrRolledBack = errors.New("transaction has already been committed or rolled back")
View Source
var ErrUnsupportedResultFormat = errors.New("unsupported result format")

Functions

This section is empty.

Types

type Columns

type Columns []string

type Config

type Config struct {
	DSN             string `yaml:"dsn" json:"dsn"`
	Host            string `yaml:"host" json:"host"`
	User            string `yaml:"user" json:"user"`
	Password        string `yaml:"password" json:"password"`
	DatabaseName    string `yaml:"database_name" json:"database_name"`
	Port            int    `yaml:"port" json:"port"`
	ParseTime       bool   `yaml:"parse_time" json:"parse_time"`
	MultiStatements bool   `yaml:"multi_statements" json:"multi_statements"`
	TLS             string `yaml:"tls" json:"tls"`
	TLSCAFile       string `yaml:"tls_ca_file" json:"tls_ca_file"`
}

func (*Config) GetDSN

func (c *Config) GetDSN() string

func (*Config) Validate

func (c *Config) Validate() error

type DatabaseTransaction

type DatabaseTransaction interface {
	QueryContext(ctx context.Context, query string, resultFormat ResultFormat) (string, error)
	ExecContext(ctx context.Context, query string) error
	Rollback(ctx context.Context) error
	Commit(ctx context.Context) error
}

func NewDatabaseTransaction

func NewDatabaseTransaction(ctx context.Context, config Config) (DatabaseTransaction, error)

type ResultFormat

type ResultFormat int

type RowMap

type RowMap map[string]interface{}

Jump to

Keyboard shortcuts

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