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 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"`
}
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
Click to show internal directories.
Click to hide internal directories.