pgsqldb

package
v0.0.0-...-e80c572 Latest Latest
Warning

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

Go to latest
Published: Feb 25, 2025 License: BSD-3-Clause Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetConfig

func GetConfig(config dictx.Dict) (*sqldb.Config, error)

GetConfig creates configuration object from configuration dict. it checks and returns error if not all options have valid values.

The parsed config options are:

  • database: (string) the database name - REQUIRED
  • host: (string) the database server IP or FQDN - REQUIRED
  • port: (int) the database server port number - REQUIRED
  • username: (string) the database access username (if any)
  • password: (string) the database access password (if any)
  • args: (string) the database extra connection params.

func InteractiveConfig

func InteractiveConfig(defaults dictx.Dict) (dictx.Dict, error)

InteractiveConfig gets the database configuration interactively from console. The database default options are detailed in GetConfig

func InteractiveSetup

func InteractiveSetup(config dictx.Dict) error

InteractiveSetup performs an interactive console based database setup. The database config options are detailed in GetConfig

Types

type Engine

type Engine struct {
	// contains filtered or unexported fields
}

Engine represents the backend engine structure.

func NewEngine

func NewEngine(config dictx.Dict) (*Engine, error)

NewEngine creates new engine handler for the backend.

func (*Engine) Backend

func (e *Engine) Backend() sqldb.Backend

Backend returns the engine backend type.

func (*Engine) CanRetryErr

func (e *Engine) CanRetryErr(err error) bool

CanRetryErr checks weather an operation error type can be retried.

func (*Engine) Close

func (e *Engine) Close()

Close the engine backend connection.

func (*Engine) Config

func (e *Engine) Config() *sqldb.Config

Config returns the engine connection config.

func (*Engine) GenSchema

func (*Engine) GenSchema(tablename string, meta *sqldb.TableMeta) string

GenSchema generates table schema.

func (*Engine) Open

func (e *Engine) Open() error

Open the engine backend connection.

func (*Engine) SqlDB

func (e *Engine) SqlDB() *sql.DB

SqlDB returns the driver database handler.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
JackTT - Gopher 🇻🇳