types

package
v0.0.0-...-7ee07da Latest Latest
Warning

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

Go to latest
Published: Jan 9, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DbConnection

type DbConnection struct {
	Info          *DbConnectionInfo
	SqlConnection *sql.DB
}

DbConnection is the connection info for a database.

type DbConnectionInfo

type DbConnectionInfo struct {
	Dialect      string `json:"dialect,omitempty"`
	Name         string `json:"name,omitempty"`
	Host         string `json:"host,omitempty"`
	Port         int    `json:"port,omitempty"`
	User         string `json:"user,omitempty"`
	Password     string `json:"password,omitempty"`
	DatabaseName string `json:"database,omitempty"`
}

func (*DbConnectionInfo) Connect

func (self *DbConnectionInfo) Connect() (*sql.DB, safego.Option[error])

Connect connects to the database and returns the sql.DB object.

func (*DbConnectionInfo) GetConnectionString

func (self *DbConnectionInfo) GetConnectionString() (string, safego.Option[string])

GetConnectionString retrieves the valid sql connection string for the current dialect. It returns an error if the dialect isn't supported.

type UserConfig

type UserConfig struct {
	DbConnections map[string]*DbConnectionInfo `json:"db_connections,omitempty"`
}

func (*UserConfig) String

func (uc *UserConfig) String() string

Jump to

Keyboard shortcuts

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