connection

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: May 13, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConnectToDatabase

func ConnectToDatabase(c *Connection, dbType string) (*sql.DB, error)

ConnectToDatabase connects to a database using the provided Connection info and database type.

func Disconnect

func Disconnect(db *sql.DB) error

Disconnect closes the database connection.

Types

type Connection

type Connection struct {
	Host     string      `json:"host"`
	Port     int         `json:"port"`
	User     string      `json:"user"`
	Password string      `json:"password"`
	Name     string      `json:"database"`
	Type     _sql.DbType `json:"databaseType"`
	Path     string      `json:"path"`
}

Connection represents a database connection info.

func (*Connection) MarshalJSON

func (c *Connection) MarshalJSON() ([]byte, error)

MarshalJSON customizes the JSON marshaling for the Connection type.

func (*Connection) UnmarshalJSON

func (c *Connection) UnmarshalJSON(data []byte) error

UnmarshalJSON customizes the JSON unmarshaling for the Connection type.

Jump to

Keyboard shortcuts

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